Getting Element is not clickable exception while click on a menu link

前端 未结 2 1402
栀梦
栀梦 2020-12-07 03:46

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

相关标签:
2条回答
  • 2020-12-07 03:48

    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.

    0 讨论(0)
  • 2020-12-07 03:50

    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.

    0 讨论(0)
提交回复
热议问题