CH3-O-CH3 2021-06-08 20:01 采纳率: 33.3%
浏览 103
已采纳

python selenium 元素不再附加到DOM,它不在当前框架上下文中,或者文档已刷新

 raise exception_class(message, screen, stacktrace) selenium.common.exceptions.StaleElementReferenceException: Message: The element reference of <span> is stale; either the element is no longer attached to the DOM, it is not in the current frame context, or the document has been

  • 写回答

3条回答 默认 最新

  • CSDN专家-黄老师 2021-06-08 21:40
    关注

    selenium的定位方式不会直接出异常,类似find_element_by_id这方法,如果不存在元素,则返回None,你可以对其判断再执行对应操作。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?