Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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... 

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?

like image 640
nix86 Avatar asked Jun 23 '17 14:06

nix86


People also ask

Is not clickable at point XY other element would receive the click?

WebDriverException - Element is not clickable at point (xx, xx). Other element would receive the click'. This happens when the element is loaded into the DOM, but the position is not fixed on the UI. There can be some other divs or images or ads that are not loaded completely.

How do you check whether the element is clickable or not?

We can check if the element is clickable or not in Selenium webdriver using synchronization. In synchronization, there is an explicit wait where the driver waits till an expected condition for an element is met. To verify, if the element can be clicked, we shall use the elementToBeClickable condition.


1 Answers

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. Element not getting clicked due to JavaScript or AJAX calls present

Try to use Actions Class:

WebElement element = driver.findElement(By.id("id1")); Actions actions = new Actions(driver); actions.moveToElement(element).click().build().perform(); 
  1. Element not getting clicked as it is not within 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. 

Or

WebElement myelement = driver.findElement(By.id("id1")); JavascriptExecutor jse2 = (JavascriptExecutor)driver; jse2.executeScript("arguments[0].scrollIntoView()", myelement);  
  1. The page is getting refreshed before the element gets clickable.

In this case induce some wait.

  1. Element is present in the DOM but not clickable.

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. Element is present but having temporary 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. Element is present but having permanent Overlay.

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); 
like image 191
undetected Selenium Avatar answered Sep 22 '22 12:09

undetected Selenium