Open athenawisdoms opened 2 years ago
Could you try running the following?
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
import undetected_chromedriver.v2 as uc
options = ...
CHROME_DRIVER_PATH = '/usr/bin/chromedriver'
driver = uc.Chrome(executable_path=CHROME_DRIVER_PATH, options=options, headless=False)
driver.get(TARGET_URL)
try:
xpath = '//*[@id="add-to-cart-button"]'
WebDriverWait(driver, 10).until(EC.presence_of_element_located(
(By.XPATH, xpath)))
element = driver.find_element(By.XPATH, xpath)
element.click()
except Exception as e:
print("Exception:", e)
gives the output
and error
Same error if I try
or
I don't think
element
should be a Dictionary, did I go wrong somewhere?