I am getting the following dreaded error when using Chromedriver with Selenium:
"org.openqa.selenium.WebDriverException: Element is not clickable at point (xxx, yyy). Other element would receive the click: ..."
I know this has been discussed here
However my situation is a bit different in the sense if I put a delay of about 5s and then click it works fine. I don't have to do anything special, just wait.
I know I can force a click by using JS or Actions, but I want a more elegant way of handling this i.e. only click button when button becomes clickable. The problem is I don't know how to check and see if the button is clickable or not.
I've tried the following but neither work:
1) ExpectedConditions.elementToBeClickable
2) ExpectedConditions.visibilityOf
Any ideas?
I can think of two options you could try:
JavaScript
Check the
Document.readyState
property that describes the loading state of the document:You can just wait for it to become "complete". Might not be work in many cases but worth a try.
Loop
That's probably the simplest solution. Not sure about its elegance but should do the job without wasting more time than needed (This is just a very basic example, this code should not be used as-is):
I handled this using custom waitAndClick() method which uses recursion as following:
int waitCounter = 0;