Python Selenium Selenium.common.exceptions.StaleElementReferenceException Error
I have the below code from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait driver = webdriver.Firefox() driver.get('https://itunesconnect.apple
Solution 1:
The DOM is rendered when you type into the password field. You need to relocate it
password = WebDriverWait(driver, 20).until(lambda driver : driver.find_element_by_class_name('dots')) # class dots is added in the rendering
password.submit()
Solution 2:
Sometimes it happens that when you perform any operation over an element some of it's attribute such as the class, value etc. changes and you can't access it further.
Easiest way to tackle this is identify this element again and use it, example :
pass = WebDriverWait(driver, 20).until(lambda driver : driver.find_element_by_id('pwd'))
pass.submit();
Example:
Go to the apple.com log In page, when you inspect the password field. you'll find that it's class changes from password
to password focused
when you click on the field and to password focused edited
when you type over it.
Post a Comment for "Python Selenium Selenium.common.exceptions.StaleElementReferenceException Error"