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"); JavascriptExecutor jsExec = (JavascriptExecutor)driver; jsExec.executeScript("arguments[0].scrollIntoView(true);", element); And then perform the action on that element like element.click(); seleniumautomation automationtesting tips javascriptexec exception validation testing
Comments
Post a Comment