您当前的位置: 首页 >  Python

默默爬行的虫虫

暂无认证

  • 3浏览

    0关注

    84博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

[Python]selenium 爬虫报错:Message: stale element reference: element is not attached to the page document

默默爬行的虫虫 发布时间:2022-06-02 12:25:06 ,浏览量:3

selenium 爬虫时报错:Message: stale element reference: element is not attached to the page document

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

过时的元素引用:元素未附加到页面文档

错误原因:代码执行了click(),但是没有完成翻页,又爬了一次当前页,再执行翻页时页面已刷新,无法找到前面的翻页执行click()

解决方法:click() 后设置time.sleep() 强制睡一会儿就可以解决了,如果还出现,等待时间设置长一点。

关注
打赏
1658895887
查看更多评论
立即登录/注册

微信扫码登录

0.0817s