2

I'll describe my situation. I'm using wait method here

wait.until(ExpectedConditions.visibilityOfElementLocated(By.linkText("Tehingud"))).click();

With a 10 seconds wait timeout

WebDriverWait wait = new WebDriverWait(login.getDriver(), 10); 

Right after the element that comes before this one is clicked, I'm getting this error

"Element X is not clickable at point. Other element would receive the click:".

So I changed the visibilityOfElementLocated method to elementToBeClickable and then got this error

"stale element reference: element is not attached to the page document".

The help that I'm looking for is not only telling me what to use but I would really appreciate if someone could explain me why this doesn't work? My understanding is that in any case it should be waiting 10 seconds at least, shouldn't it?

1
  • I am wondering if there is some DOM changes happening and even though the element exists, it's not ready to be clicked yet because of these dynamic changes happening after the browser page load. So the .click() reports that it's not clickable while the browser indicates the element exists. It might be good to explicitly wait for something that loads last to fully load and then try again. Optionally just add like a temporary 10 second wait and try and see if it clicks or gives the same error.
    – mutt
    Mar 23, 2017 at 18:31

3 Answers 3

2

The error "Element X is not clickable at point. Other element would receive the click:" usually means that there is another element in the way or you are unable to reach to the element.

You can use this as solution:

WebDriver driver = login.getDriver();
WebElement element = driver.findElement(By.linkText("Tehingud"));
WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.visibilityOfElementLocated(element));
((JavaScriptExecutor)driver).executeScript("arguments[0].click()", element);

but it will always click the element even if it disabled. Most of the software testing company avoid the use of java script syntax.

To reach to the element you want to click either you can scroll to that particular element or you can use the below function. Hopefully it will work.

wait.until(ExpectedConditions.visibilityOfElementLocated(By.linkText("Tehingud")));
WebElement ele = wait.until(ExpectedConditions.elementToBeClickable(By.linkText("Tehingud")));
Actions builder = new Actions(driver);
Action mouseOverHome = builder
                        .moveToElement(ele)
                        .build().perform().click();
0

The error "Element X is not clickable at point. Other element would receive the click:" usually means that if Selenium tries to click on the given element there is another element in the way.

I get around this by using JavaScript to click instead:

WebDriver driver = login.getDriver();
WebElement element = driver.findElement(By.linkText("Tehingud"));
WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.visibilityOfElementLocated(element));
((JavaScriptExecutor)driver).executeScript("arguments[0].click()", element);

I use C# but tried to make the code sample (above) in Java from memory so there could be a syntax error or two.

0

You get a StaleElementReferenceException in either of the two cases listed below - 1. Your element is no longer attached to the DOM 2. Element has been deleted

Before making any changes, please check if the identifier is correct or not, i.e. your "By.(linkText---)"

Resolution: "Element X is not clickable at point. Other element would receive the click" You are getting this error because the element that needs be clicked is not yet clickable which might be because your page hasn't finished loading or a modal has appeared which makes your element un-clickable.

To solve your problem, try this -

wait.until(ExpectedConditions.visibilityOfElementLocated(By.linkText("Tehingud")));
WebElement ele = wait.until(ExpectedConditions.elementToBeClickable(By.linkText("Tehingud")));
Thread.sleep (1000);
ele.click();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.