关于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)
1
2
原代码为

next_btn = self.driver.find_element_by_xpath("//div[@class='pager_container']/span[last()]")
next_btn.click()
1
2
在网上找到的错误原因大概是因为这个按钮上面还有别的东西覆盖,后来将代码改成

next_btn = self.driver.find_element_by_xpath("//div[@class='pager_container']/span[last()]")
self.driver.execute_script("arguments[0].click();", next_btn)
1
2
即可成功运行

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值