selenium 报错 Element is not clickable at point 常见解决方法

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了selenium 报错 Element is not clickable at point 常见解决方法相关的知识,希望对你有一定的参考价值。

参考技术A

使用Selenium时,触发点击事件,经常报如下异常:

一般常见的如下四种方法:
原因一:对象未加载
说 明: 没加载出来就等待元素加载出来,再往下执行往往就会报错
解决方案:

原因二:当前页面存在frame/iframe,查找的对象不在当前frame/iframe下面
说 明: 如果元素不在当前frame/iframe里,在窗口里找是找不到frame/iframe下的元素的,所以更是无法相关操作的
解决方案: 需要要切换到i元素所在的frame/iframe里去找元素

原因三:不在视窗里
说明: 不在当前可视化的页面中
解决方案: 需要需要拉滚动条 或设置浏览器默认打开大小

原因四:要点击的元素被覆盖
解决方案: 可以使用事件链来解决
例如下拉菜单,通过hover,让子菜单显示,就可以点击了。

关于事件链详情,请点击文档。

部分参考参考 CSDN
原文链接: https://blog.csdn.net/lilongsy/article/details/76152620

以上是关于selenium 报错 Element is not clickable at point 常见解决方法的主要内容,如果未能解决你的问题,请参考以下文章

Selenium 之 报错AttributeError: 'list' object has no attribute 'click'

关于新版本selenium定位元素报错:‘WebDriver‘ object has no attribute ‘find_element_by_id‘等问题

关于报错stale element reference: element is not attach

spring “The matching wildcard is strict, but no declaration can be found for element”报错原

关于报错stale element reference: element is not attached to the page document处理

Selenium Xpath元素无法定位 NoSuchElementException: Message: no such element: Unable to locate element(代码片段