I’m trying to develop a code to get all the ingredients in each product of a site, but my Selenium doesn’t find any element when I try to use the “driver.find_element”.
I used:
chromedrive_path = 'MY_PATH'
chrome_options = webdriver.ChromeOptions()
chrome_options.binary_location = chromedrive_path
chrome_options.add_argument('--headless')
#chrome_options.add_argument('--no-sandbox')
url = 'https://www.boticario.com.br/'
chrome = webdriver.Chrome(options=chrome_options)
chrome.get(url)
sleep(3)
chrome.find_element(By.XPATH, "/html/body/header/nav/ul/li[13]/a").click()
And also:
button = WebDriverWait(chrome, 20).until(EC.element_to_be_clickable((By.XPATH, "/html/body/header/nav/ul/li[13]/a")))
button.click()
I’ve already tried many different elements too, but all of them returned the NoSuchElementException error (or the TimeoutException, for the 2nd code).
New contributor
Leandro Henrique is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.