Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging "Element is not clickable at point" error

I see this only in Chrome.

The full error message reads:

"org.openqa.selenium.WebDriverException: Element is not clickable at point (411, 675). Other element would receive the click: ..."

The element that 'would receive the click' is to the side of the element in question, not on top of it and not overlapping it, not moving around the page.

I have tried adding an offset, but that does not work either. The item is on the displayed window without any need for scrolling.

like image 388
user1591169 Avatar asked Aug 10 '12 19:08

user1591169


People also ask

Is not clickable at point () other element would receive the click?

What Is the “Element Is Not Clickable at Point” Error? The error “element is not clickable at point” is self-explanatory. It means that the element that you're trying to click on can't be clicked at that particular point. You'd usually find this error when you locate an element and try to execute a click action on it.

How do you check whether the element is clickable or not?

We can check if the element is clickable or not in Selenium webdriver using synchronization. In synchronization, there is an explicit wait where the driver waits till an expected condition for an element is met. To verify, if the element can be clicked, we shall use the elementToBeClickable condition.

Why click is not working in Selenium?

We can list the most common reasons for click problems as being one of the following: Wrong web element locations. The existence of a web element that obscures the web element that we want to click. The Selenium WebDriver works much faster than the response of the application.


3 Answers

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.

like image 161
Prabu Ananthakrishnan Avatar answered Oct 13 '22 01:10

Prabu Ananthakrishnan


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

IJavaScriptExecutor ex = (IJavaScriptExecutor)Driver;
ex.ExecuteScript("arguments[0].click();", elementToClick);
like image 20
Bart Wojtala Avatar answered Oct 13 '22 01:10

Bart Wojtala


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-

like image 44
Tony Lâmpada Avatar answered Oct 13 '22 02:10

Tony Lâmpada