I am not sure what is wrong with this. Am I using EC.element_to_be_clickable()
right? I am getting the error message: "selenium.common.exceptions.StaleElementReferenceException: Message: stale element reference: element is not attached to the page document
". I am pretty sure the XPATH is valid and have even tried with another that designates the same element.
My code:
driver.get("https://browzine.com/libraries/1374/subjects")
parent_url = "https://browzine.com/libraries/1374/subjects"
wait = WebDriverWait(driver, 10)
subjects_avail = driver.find_elements(By.XPATH, "//span[@class='subjects-list-subject-name']")
subjects = 0
for sub in subjects_avail:
WebDriverWait(driver, 5).until(EC.element_to_be_clickable(
(By.XPATH, "//span[@class='subjects-list-subject-name']")))
ActionChains(driver).move_to_element(sub).click(sub).perform()
subjects = +1
driver.get(parent_url)