(StaleElementException:Selenium) How do I handle this?

前端 未结 2 2080
小蘑菇
小蘑菇 2021-01-26 10:28

This is my first time first day working on selenium and I have no hands on experience on Web Technologies in depth either.

Working around, I have been facing StaleElemen

2条回答
  •  被撕碎了的回忆
    2021-01-26 11:11

    The StaleElementException occurs when the webelement in question is changed on the dom and the initial reference to that webelement is lost.

    You can search for the webelement again

    try this

    try:
     element = self.find_element_by_class('')
     element.click()
    except StaleElementReferenceException:
     element = self.find_element_by_class('')
     element.click()
    

提交回复
热议问题