原文:stale element reference: element is not attached to the page document 异常

在执行脚本时,有时候引用一些元素对象会抛出如下异常 org.openqa.selenium.StaleElementReferenceException: stale element reference: element is not attached to the page document 按字面表达的意思大概是,所引用的元素已过时,不再依附于当前页面。通常情况下,这是因为页面进行了刷新或跳转 ...

2017-08-25 09:37 0 4283 推荐指数:

查看详情

selenium.common.exceptions.StaleElementReferenceException: Message: stale element reference: element is not attached to the page document

抓取网页代码后,由于是在同一个li标签下,所以使用一次性抓取,所有的a标签,然后循环做不同的操作,但是抛出找不到元素异常。 屏幕日志: 最后原因是因为刷新页面导致之前拿到的元素对象失效,无法锁定,从而导致改报错。 坑: 页面点击之后刷新了 之前抓取的元素对象失效 ...

Sat Oct 12 02:35:00 CST 2019 0 319
 
粤ICP备18138465号  © 2018-2026 CODEPRJ.COM