欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

selenium报错

程序员文章站 2022-05-29 11:49:13
...

selenium定位时报错:

selenium.common.exceptions.ElementClickInterceptedException: Message: Element <span class="pager_next "> is not clickable at point (635,697) because another element <div class="foot-fix-ad-container-background"> obscures it

这是一种反爬机制,当要点击的按钮不在视野范围内时,就定位不到元素,所以需要移动滚动条,把要定位的元素显示在屏幕上。使用selenium执行js语句:

driver.execute_script("window.scrollTo(0, document.body.scrollHeight)")

 

相关标签: selenium错误处理