StaleElementReferenceException on Python Selenium

后端 未结 9 2135
孤独总比滥情好
孤独总比滥情好 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 14:04

    In my case, the problem

    stale element reference: element is not attached to the page document

    was because I tried to use actions.move_to_element(element).perform() on actions that created from old Selenium tab.

    So the solution is to create new actions instance after opening new tab:

    actions = ActionChains(browser)
    actions.move_to_element(element).perform()
    

提交回复
热议问题