I used explicit waits and I have the warning:
org.openqa.selenium.WebDriverException: Element is not clickable at point (36, 72). Other element would receive the click: ... Command duration or timeout: 393 milliseconds
If I use Thread.sleep(2000)
I don't receive any warnings.
@Test(dataProvider = "menuData")
public void Main(String btnMenu, String TitleResultPage, String Text) throws InterruptedException {
WebDriverWait wait = new WebDriverWait(driver, 10);
driver.findElement(By.id("navigationPageButton")).click();
try {
wait.until(ExpectedConditions.elementToBeClickable(By.cssSelector(btnMenu)));
} catch (Exception e) {
System.out.println("Oh");
}
driver.findElement(By.cssSelector(btnMenu)).click();
Assert.assertEquals(driver.findElement(By.cssSelector(TitleResultPage)).getText(), Text);
}
Scrolling the page to the near by point mentioned in the exception did the trick for me. Below is code snippet:
NOTE: I use Facebook php webdriver
In case you need to use it with Javascript
We can use arguments[0].click() to simulate click operation.
I ran into this error while trying to click some element (or its overlay, I didn't care), and the other answers didn't work for me. I fixed it by using the
elementFromPoint
DOM API to find the element that Selenium wanted me to click on instead:I've also had situations where an element was moving, for example because an element above it on the page was doing an animated expand or collapse. In that case, this Expected Condition class helped. You give it the elements that are animated, not the ones you want to click. This version only works for jQuery animations.
WebDriverException: Element is not clickable at point (x, y)
This is a typical
org.openqa.selenium.WebDriverException
which extendsjava.lang.RuntimeException
.The fields of this exception are :
BASE_SUPPORT_URL
:protected static final java.lang.String BASE_SUPPORT_URL
DRIVER_INFO
:public static final java.lang.String DRIVER_INFO
SESSION_ID
:public static final java.lang.String SESSION_ID
About your individual usecase, the error tells it all :
It is clear from your code block that you have defined the
wait
asWebDriverWait wait = new WebDriverWait(driver, 10);
but you are calling theclick()
method on the element before theExplicitWait
comes into play as inuntil(ExpectedConditions.elementToBeClickable)
.Solution
The error
Element is not clickable at point (x, y)
can arise from 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:2. Element not getting clicked as it is not within Viewport
Try to use
JavascriptExecutor
to bring the element within the Viewport:3. The page is getting refreshed before the element gets clickable.
In this case induce
ExplicitWait
i.eWebDriverWait
as mentioned in point 4.4. Element is present in the DOM but not clickable.
In this case induce
ExplicitWait
withExpectedConditions
set toelementToBeClickable
for the element to be clickable:5. Element is present but having temporary Overlay.
In this case induce
ExplicitWait
withExpectedConditions
set toinvisibilityOfElementLocated
for the Overlay to be invisible.6. Element is present but having permanent Overlay.
Use
JavascriptExecutor
to send the click directly on the element.You can try