StaleElementReferenceException on Python Selenium

后端 未结 9 2109
孤独总比滥情好
孤独总比滥情好 2020-11-27 13:28

I am getting the following error while using Selenium in python:

selenium.common.exceptions.StaleElementReferenceException: Message: u\'stale element referen         


        
9条回答
  •  遥遥无期
    2020-11-27 13:55

    For my python scripts, on quite simple pages, all above mentioned solutions didn't work. I found here -> https://www.softwaretestingmaterial.com/stale-element-reference-exception-selenium-webdriver/ the simplest way for my problem. It's just refreshing before clicking.

    driver.refresh()
    driver.find_element_by_id('normal').click()
    

    Note: I'm using driver.implicitly_wait(5) instead of explicit waits but it works in both options.

提交回复
热议问题