WebDriver - element is not clickable Chrome
I am assuming that you have the correct element you need, ie the XPath is correct. Here are few ways out:
- Try to Click on the
parent element
instead. - Try .
Submit()
instead of.Click()
- Try to execute the
JavaScript
that will be executed on theOnClick
event of the element you are trying to click.
I have used the 3rd way with success all the time.
Another one
- Do a
.SendKeys(Keys.Enter)
on that element (or a Space key)
Since you've tagged the question as Google-Chrome too - I suppose that this is happening mostly with ChromeDriver. I had the same issues with one of my previous projects (Asp .Net MVC). I found that when some elements are not visible for this Driver if they are not in the screen_visible_area. Please note that they are loaded (HTML, CSS3, JS etc.) properly.
So after a lot of reading and testing, I found that my workaround is simply scroll to the WebElement - so it is in the visible part of the screen. Actually this issue was not for all elements and I didn't find better solution for it.
unknown error: Element is not clickable at point (..., ...)
Is not descriptive error for this case, because like you I also thought that is Selector-related.
Just to be full answer - I had the same problems with IEDriver too. My implementation was to use the Browser scroll down/up options and just "send the screen" where the problematic element is.
Simple JSExecutor code that you can use:
WebDriver driver = new FirefoxDriver();
JavascriptExecutor jse = (JavascriptExecutor)driver;
jse.executeScript("window.scrollBy(110,350)", "");
or
jse.executeScript("scroll(0, 250);");
or
driver.executeScript("window.scrollBy(110,350)", "");
Other topic-related useful resources are here.
Update
When it comes to the .sendKeys()
I also used the browser accessibility features. All you need to do is just count how many TAB clicks your test need in order to get to the targeted web_element. Then just call .click()
.
Try this simple code:
element.sendKeys(Keys.TAB);
or
element.sendKeys("\t")
or
Actions builder = new Actions(driver);
builder.keyDown(Keys.TAB).perform()