Debugging "Element is not clickable at point" error Debugging "Element is not clickable at point" error selenium selenium

Debugging "Element is not clickable at point" error


This is caused by following 3 types:

1.The element is not visible to click.

Use Actions or JavascriptExecutor for making it to click.

By Actions:

WebElement element = driver.findElement(By("element_path"));Actions actions = new Actions(driver);actions.moveToElement(element).click().perform();

By JavascriptExecutor:

JavascriptExecutor jse = (JavascriptExecutor)driver;jse.executeScript("scroll(250, 0)"); // if the element is on top.jse.executeScript("scroll(0, 250)"); // if the element is on bottom.

or

JavascriptExecutor jse = (JavascriptExecutor)driver;jse.executeScript("arguments[0].scrollIntoView()", Webelement); 

Then click on the element.

2.The page is getting refreshed before it is clicking the element.

For this, make the page to wait for few seconds.

3. The element is clickable but there is a spinner/overlay on top of it

The below code will wait until the overlay disppears

By loadingImage = By.id("loading image ID");WebDriverWait wait = new WebDriverWait(driver, timeOutInSeconds);wait.until(ExpectedConditions.invisibilityOfElementLocated(loadingImage));

Then click on the element.


You can also use JavaScript click and scrolling would be not required then.

IJavaScriptExecutor ex = (IJavaScriptExecutor)Driver;ex.ExecuteScript("arguments[0].click();", elementToClick);


There seems to be a bug in chromedriver for that (the problem is that it's marked as won't fix)--> GitHub Link

(place a bounty on FreedomSponsors perhaps?)

There's a workaround suggested at comment #27.Maybe it'll work for you-