I am learning automation in Selenium web driver python. Some of my automations are not able to find elements even though I clearly depict where it is, for example for Barnes and Noble website I search for the search bar using class name:
driver.maximize_window()
time.sleep(7)
search_bar = driver.find_element(By.CLASS_NAME,’rbt-input-main form-control rbt-input user-success’)
It is unable to find it. Another example is when I search for something with a full xpath:
self.fifty_xpath=”/html/body/div/div[3]/form/div[2]/div/div[2]/div[2]/div/div/div[2]/div[1]/div/span/div/div[3]/label/div/div[1]/div/div[3]/div”
self.driver.find_element(By.XPATH, self.fifty_xpath).click()
When I follow along to tutorials it is fine I just have trouble when I create my own automations
I tried finding with multiple sources (id, name, xpath) and also tried different sections to see which can be clicked. The main and only problem is it cannot find the element from the CSS selector.
Ranjani Ramanathan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.