How do I resolve the ElementNotInteractableException in Selenium WebDriver?

selenium

How do I resolve the ElementNotInteractableException in Selenium WebDriver?

1
Answers

Replies

The ElementNotInteractableException usually occurs when the element is found but it cannot be interacted with. In order to make it interactable, you will need to do the following steps.


1.Wait until an element is visible / clickable


WebDriverWait wait = new WebDriverWait(driver, timeout);


wait.until(ExpectedConditions.visibilityOf(element)); 


wait.until(ExpectedConditions.elementToBeClickable(element));


2.Scroll until the element is within the the display


Actions action = new Actions(driver);


action.moveToElement(element);


3.Use JS Executor to interact directly with the DOM


JavascriptExecutor javascript = (JavascriptExecutor) driver;


javascript.executeScript("var element = document.querySelector('locator'); element.value = 'whatever';")

 
 

If you want to unleash your potential in this competitive field, please visit the selenium course page for more information, where you can find the selenium tutorials and selenium frequently asked interview questions and answers as well.

 

This topic has been locked/unapproved. No replies allowed

Login to participate in this discussion.

Leave a reply

Before proceeding, please check your email for a verification link. If you did not receive the email, click here to request another.