元素MyElement在点(x,y)处不可点击...其他元素将收到点击 [英] Element MyElement is not clickable at point (x, y)... Other element would receive the click

查看:187
本文介绍了元素MyElement在点(x,y)处不可点击...其他元素将收到点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用基于硒的Katalon Studio进行一些测试。在我的一个测试中,我必须在textarea内写。问题是我收到以下错误:

I am trying to make some tests using selenium based Katalon Studio. In one of my tests I have to write inside a textarea. The problem is that I get the following error:

...Element MyElement is not clickable at point (x, y)... Other element would receive the click...

实际上我的元素放在其他一些女主角里面这可能会隐藏它但是如何让click事件命中我的textarea?

In fact my element is place inside some other diva that might hide it but how can I make the click event hit my textarea?

推荐答案

元素.. 。在点(x,y)处不可点击。其他元素会收到点击可能会导致不同的因素。您可以通过以下任一程序解决它们:

Element ... is not clickable at point (x, y). Other element would receive the click" can be caused for different factors. You can address them by either of the following procedures:


  1. 由于存在JavaScript或AJAX调用而未点击元素

尝试使用操作类:

WebElement element = driver.findElement(By.id("id1"));
Actions actions = new Actions(driver);
actions.moveToElement(element).click().build().perform();




  1. 元素未被点击,因为它不在视口

  1. Element not getting clicked as it is not within Viewport

尝试使用 JavascriptExecutor 将元素放在Viewport中:

Try to use JavascriptExecutor to bring the element within Viewport:

JavascriptExecutor jse1 = (JavascriptExecutor)driver;
jse1.executeScript("scroll(250, 0)"); // if the element is on top.
jse1.executeScript("scroll(0, 250)"); // if the element is at bottom.

WebElement myelement = driver.findElement(By.id("id1"));
JavascriptExecutor jse2 = (JavascriptExecutor)driver;
jse2.executeScript("arguments[0].scrollIntoView()", myelement); 




  1. 页面在元素获取之前刷新可点击。

在这种情况下,诱导一些等待

In this case induce some wait.


  1. 元素存在于DOM中但不可点击。

在这种情况下,为要点击的元素添加一些 ExplicitWait

In this case add some ExplicitWait for the element to be clickable.

WebDriverWait wait2 = new WebDriverWait(driver, 10);
wait2.until(ExpectedConditions.elementToBeClickable(By.id("id1")));




  1. 元素存在但具有临时叠加。

在这种情况下,使用 ExplicitWait > ExpectedConditions 设置为 invisibilityOfElementLocated ,以使Overlay不可见。

In this case induce ExplicitWait with ExpectedConditions set to invisibilityOfElementLocated for the Overlay to be invisible.

WebDriverWait wait3 = new WebDriverWait(driver, 10);
wait3.until(ExpectedConditions.invisibilityOfElementLocated(By.xpath("ele_to_inv")));




  1. 元素存在但具有永久叠加。

使用 JavascriptExecutor 直接在元素上发送点击。

Use JavascriptExecutor to send the click directly on the element.

WebElement ele = driver.findElement(By.xpath("element_xpath"));
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("arguments[0].click();", ele);

这篇关于元素MyElement在点(x,y)处不可点击...其他元素将收到点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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