Skip to main content

Posts

Showing posts with the label WebDriverException

Have you ever encountered this type of Exception where it says Element can't be clickable?

Element can't be clickable exception in Selenium : org.openqa.selenium.WebDriverException: unknown error: Element is not clickable at point (660, 823) (Session info: chrome=76.0.3809.132) (Driver info: chromedriver=2.38.552518 (183d19265345f54ce39cbb94cf81ba5f15905011),platform=XXX.XXXXX) Command duration or timeout: 65 milliseconds Most of the time. we go and first check manually to see that the element is visible and clickable. And then, you check the locator that you have selected is correct and the element also shows in the browser DOM. Then why is it failing? One of the reasons may be that the element is not in the viewport. So, how we can resolve this? Scroll to the page so that the element becomes visible, then hopefully the exception should not occur. JavascriptExecutor jsExec = (JavascriptExecutor)driver; jsExec.executeScript("window.scrollTo(0, document.body.scrollHeight)"); or WebElement element = document.getElementById("submit"); Javascript