'Element not clickable being blocked still fails using ExpectedConditions
Using SeleniumExtras.WaitHelpers nuget pkg
Trying to click a button on a page but as the page is loading there is a sort of blocking div that is causing an error. I noticed that if I just gradually step through the code, things work as expected, but when I just let the code run, I catch an exception that mentions something is blocking it. Browsing the site I can see the blocking div occasionally. First I tried just using a wait, and that was when I discovered the error, but when using ExpectedConditions I am still getting it. What cam I missing?
IWebElement dtLink = new WebDriverWait(Driver, TimeSpan.FromSeconds(45))
.Until(ExpectedConditions.ElementToBeClickable(By.XPath(date_link_path)));
dtLink .Click();
The exception message mentions this:
...is not clickable at point (115,311) ...because another element obscures it
Solution 1:[1]
When this error occurs there are 2 main ways to deal with that:
It is your way that you already did it.
Using 'Javascript' executor it will definitely work. Here it is code example:
IJavaScriptExecutor executor = (IJavaScriptExecutor)driver ; executor.ExecuteScript("arguments[0].click();", dtLink);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Rashad Nasirli |
