元素不可点击 [英] Element is not clickable

查看:92
本文介绍了元素不可点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试单击与我的词典值名称"和颜色"相对应的项目,但我不断收到追溯错误:

I'm trying to click on an item that corresponds to my dictionary value "name" and "color," but I keep getting a traceback error:

raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: unknown error: Element is not clickable at point (520, 815)

简而言之,我正在尝试创建一个自动签出脚本,该脚本从下面的词典(即ITEM_INFO,SHIPPING_INFO和BILLING_INFO)接收参数,并将其发送到Selenium驱动程序.问题在于,浏览器在导航到产品类别后找不到产品名称,因为产品名称不可单击.我试图通过显式等待来缓解这种情况,但仍然收到相同的错误消息.理想情况下,我希望能够将值传递给ITEM_INFO,然后让硒传递值.

In short, I'm trying to create an auto-checkout script that takes in parameters from the dictionaries below (i.e. ITEM_INFO, SHIPPING_INFO and BILLING_INFO) and sends them to the Selenium driver. The problem is that after the browser cannot find the product name after navigating to the product category because the product name is not clickable. I tried to mitigate this by using an explicit wait, but I still get the same error message.Ideally, I'd like to be able to pass in values to ITEM_INFO and then have selenium pass in the values.

推荐答案

原因是您尝试单击不可单击的元素.在这种情况下,WebDriver会引发异常:

The reason is that you try to click on an element which is not clickable. In this case WebDriver throws an exception:

WebDriverException:...元素在点(520,815)不可点击

WebDriverException: ... Element is not clickable at point (520, 815)

您必须找出为什么页面不允许单击元素的原因.这可能是由于(a)一些业务逻辑或(b)时序问题.对于(a),请更改您的测试用例,以使该元素可单击.对于(b),请使用显式等待使元素变为可点击

You have to find out why the page does not allow the element to be clicked. It can either be due to (a) some business logic or (b) a timing issue. For (a) change your test case so that the element becomes clickable. For (b) use an explicit wait for the element to become clickable

这篇关于元素不可点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆