close

[Solved] ElementNotInteractableException in Selenium WebDriver

Hello Guys, How are you all? Hope You all Are Fine. Today I am trying to run selenium webdriver But I am facing following error ElementNotInteractableException in Selenium WebDriver in java. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How ElementNotInteractableException in Selenium WebDriver Error Occurs?

I am trying to run selenium webdriver But I am facing following error.

ElementNotInteractableException in Selenium WebDriver

How To Solve ElementNotInteractableException in Selenium WebDriver Error ?

  1. How To Solve ElementNotInteractableException in Selenium WebDriver Error ?

    To Solve ElementNotInteractableException in Selenium WebDriver Error Just Wait until an element is visible / clickable. Second solution is Scroll until the element is within the the display Third solution is Use JS Executor to interact directly with the DOM. Now, Your Error should be solved.

  2. ElementNotInteractableException in Selenium WebDriver

    To Solve ElementNotInteractableException in Selenium WebDriver Error Just Wait until an element is visible / clickable. Second solution is Scroll until the element is within the the display Third solution is Use JS Executor to interact directly with the DOM. Now, Your Error should be solved.

Solution 1: Wait until an element is visible / clickable

Just Wait until an element is visible / clickable.

WebDriverWait wait = new WebDriverWait(driver, timeout);
wait.until(ExpectedConditions.visibilityOf(element)); 
wait.until(ExpectedConditions.elementToBeClickable(element));

Solution 2: Scroll until the element is within the the display

Scroll until the element is within the the display.

Actions action = new Actions(driver);
action.moveToElement(element);

Solution 3: Use JS Executor to interact directly with the DOM

Use JS Executor to interact directly with the DOM.

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

Now, Your Error should be solved.

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read