今天在看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)
即可成功运行
初学爬虫为方便以后查看并且和大家讨论用
原博主内容
博主在学习Python爬虫,观看Selenium相关视频时遇到报错。原代码运行出错,网上查找得知是按钮被其他东西覆盖,修改代码后成功运行。博主记录此过程,方便日后查看并与大家讨论。

966

被折叠的 条评论
为什么被折叠?



