Selenium clicking WebElement error 'Element is not clickable at point'

  • 1 Replies
  • 1533 Views
When trying to click an item with WebElement.click() I get the following error : 'Element is not clickable at point (526, 17)'
I am positive that my locator is good (located by Id)

Any idea why this happens ?

*

Haim

  • *
  • 10
Re: Selenium clicking WebElement error 'Element is not clickable at point'
« Reply #1 on: February 16, 2016, 16:29:13 pm »
It seems like this problem only occurs in google chrome.

What you need to do is verify that the element is :
1) present in the DOM
2) visible in the UI
3) Position is fixed (chrome)

There are a number of options to achieve this. you can read it here :

http://www.seleniumeasy.com/selenium-tutorials/element-is-not-clickable-at-point-selenium-webdriver-exception

The best solution in my opinion would be :
Code
WebElement element = driver.findElement(By.id(""));
JavascriptExecutor js =(JavascriptExecutor)driver;
js.executeScript("window.scrollTo(0,"element.getLocation().y+")");
element.click();

This will locate the 'Y' position of your element beforehand, and thus ensure that you are able to click it.

 

Sitemap 1 2 3 4 5 6 7 8