关于element click intercepted报错解决办法

今天在看python爬虫视频Selenium过程中遇到报错为

selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element <span hidefocus="hidefocus" action="next" class="pager_next ">...</span> is not clickable at point (604, 852). Other element would receive the click: <div class="body-container showData">...</div>
  (Session info: chrome=86.0.4240.111)

原代码为

 next_btn = self.driver.find_element_by_xpath("//div[@class='pager_container']/span[last()]")
 next_btn.click()

在网上找到的错误原因大概是因为这个按钮上面还有别的东西覆盖,后来将代码改成

next_btn = self.driver.find_element_by_xpath("//div[@class='pager_container']/span[last()]")
self.driver.execute_script("arguments[0].click();", next_btn)

即可成功运行
初学爬虫为方便以后查看并且和大家讨论用
原博主内容

  • 38
    点赞
  • 72
    收藏
    觉得还不错? 一键收藏
  • 17
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 17
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值