python,使用selenium的隐式等待driver.implicitly_wait(10) ,总是报selenium.common.exceptions.StaleElementReferenceException: Message: stale element reference: element is not attached to the page document错误,我换回time的强制等待就可以了,求大佬解答
selenium版本是,3.141.0
Webdriver Manager 版本是:3.8.5
这个问题是你爬取的目标网页数据还没加载完,你的爬虫就开始爬取了,自然就返回报错
不知道你这个问题是否已经解决, 如果还没有解决的话:说明:Selenium中对处理弹出框的操作,有专用的处理方法;并且处理的方法都一样
1. 获取弹出框对象
alert = driver.switch_to.alert
2. 调用
alert.text --> 返回alert/confirm/prompt中的文字信息
alert.accept() --> 接受对话框选项
alert.dismiss() --> 取消对话框选项