I am trying to click on a menu link but not have any luck. It always showing exception -
Exception in thread \"main\" org.openqa.selenium.WebDriverExc
I had the same problem and tried many solution but it didn't work.Lastly i saw selenium docs and found stalenessof
new WebDriverWait(driver, 10).until(ExpectedConditions.stalenessOf(findElement(By.xpath("element_path"))));
It should work now.
Try to wait until element that gets click disappeared:
new WebDriverWait(driver, 10).until(ExpectedConditions.invisibilityOfElementLocated(By.xpath('//div[@style="position: absolute; left: 0px; top: 0px; width: 100%; height: 100%; z-index: 30; background-color: rgb(221, 221, 221); opacity: 0.4;"]')));
As this answer was downvoted, I add some more details to explain why it could be acceptable solution.
It's a known issue (I personally have faced it few times) of chromedriver
: chromedriver
sometimes ignores modal windows such as "Page loading in progress"
and "thinks" that target element (that is covered by modal window) actually visible and clickable and tries to make click which is received by modal window.
So it makes sense to wait until modal window disappeared.