Skip to content Skip to sidebar Skip to footer

Staleelementreferenceexception On Firefoxwebelement.get_attribute Even After Webdriverwait

I am trying to get the inner text of a specific element on a website (which runs on React production build) using Selenium. I am doing the following: driver = webdriver.Firefox() d

Solution 1:

Stale element state that the DOM (Page HTML) was modified after the element was located.

so for example:

print(elem.get_attribute('innerText'))
 clicksomebutton.click()
 print(elem.get_attribute('innerText'))

It fail if click refreshes or loads something on the screen. FOr this to work you have to find element again.

print(elem.get_attribute('innerText'))
 clicksomebutton.click()
 print(driver.find_element_by_xpath('blabla').get_attribute('innerText'))




 

Post a Comment for "Staleelementreferenceexception On Firefoxwebelement.get_attribute Even After Webdriverwait"