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);
}
Best Answer
WebDriverException: Element is not clickable at point (x, y)
This is a typical org.openqa.selenium.WebDriverException which extends java.lang.RuntimeException.
The fields of this exception are :
protected static final java.lang.String BASE_SUPPORT_URL
public static final java.lang.String DRIVER_INFO
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.e WebDriverWait as mentioned in point 4.
4. Element is present in the DOM but not clickable.
In this case induce ExplicitWait with
ExpectedConditions
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.