Selenium“元素不可点击”在Firefox中的错误,但在Chrome中工作 [英] Selenium “Element is not clickable at point” error in Firefox but working in Chrome

查看:230
本文介绍了Selenium“元素不可点击”在Firefox中的错误,但在Chrome中工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在硒中,我试图找到一个元素。
但是得到以下错误:

pre $ org.openqa.selenium.WebDriverException:元素不可点击点(1009.25 ,448.183349609375)。其他元素将收到点击:< rect data-sdf-index =7height =390width =420class =aw-relations-noeditable-area>< / rect> (警告:服务器没有提供任何堆栈跟踪信息)
命令持续时间或超时:12毫秒



<在 firefox 中获取这个错误。但是它在 Chrome 浏览器中成功运行。
是否有人有解决方案吗?

我已经试过这个帖子的帮助:

我写了下面的代码:

  public void createPortOnSelectedNode(String nodeName){
ISingleLocator m_nodeContainer = m_nodePage.getNodeContainer();
WebElement node = m_nodePage.getNode(m_nodeContainer,nodeName).getElement();
操作action = new Actions(DefaultDriver.getWebDriver());
action.moveToElement(node,40,0);
action.click();
action.perform();


这种情况下,您的webdriver脚本执行的操作,但您想要做的操作元素没有正确加载DOM 内,即其位置不固定在DOM树内(也请注意硒能够执行它的动作,因为元素在DOM 内是可用的<因此 webdriver只查找DOM内的元素的存在,而不是在DOM内的位置)
$ b

那么如何解决这个问题?

 其元素。 

可以通过以下方式实现:

<$不要直接在目标区域执行操作,而是使用webdriver执行一些额外/虚假的
活动,这会给DOM定位所有元素
2.应用Thread.sleep()。
3.如果你正在用较小的窗口大小运行你的测试,然后将大小设置为最大值
也将帮助

我没有包含任何代码,因为你在问题中提到的链接包含了大量的工作,所以我决定让每个人都低估为什么会出现这个错误。谢谢,希望这有助于

In Selenium I am trying to locate an element. But getting the below error:

org.openqa.selenium.WebDriverException: Element is not clickable at point (1009.25, 448.183349609375). Other element would receive the click: <rect data-sdf-index="7" height="390" width="420" class="aw-relations-noeditable-area"></rect> (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 12 milliseconds

Getting this error in firefox. But its working successfully in Chrome browser. Is anyone having solution for it?

I already tried help from this post:-Selenium "Element is not clickable at point" error in Firefox but not able to get the result.

I have written below code:

public void createPortOnSelectedNode( String nodeName ) {
    ISingleLocator m_nodeContainer = m_nodePage.getNodeContainer();
    WebElement node = m_nodePage.getNode( m_nodeContainer, nodeName ).getElement();
    Actions action = new Actions(DefaultDriver.getWebDriver());
    action.moveToElement(node, 40, 0);
    action.click();
    action.perform();
}

解决方案

Hi the above error comes under such scenario where Your webdriver script performs the action but the element on which you want to do operation is not properly loaded inside the DOM i.e its position is not fixed inside the DOM tree (also note selenium is able to perform its action because element is available inside the DOM hence webdriver only looks for the presence of element inside the DOM and not its position inside the DOM)

So how to overcome this issue

   1.Give time to DOM to properly give positions to its element.

and that can be achieved by :

1.Instead of performing operation's directly at the target area try to do some extra/false 
activity with webdriver which will give time for DOM to position all of his elements
2.apply Thread.sleep().
3. also if you are running your test in smaller window size then set the size to maximum it 
will also help

i have not included any code cause the link that you have refer in the question contains ample amount of work regarding that so i decided to make everybody underrated why this error occurs. thanks hope this helps

这篇关于Selenium“元素不可点击”在Firefox中的错误,但在Chrome中工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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