How do I resolve the ElementNotInteractableException in Selenium WebDriver?

We get the ElementNotInteractableException in Selenium if an element is available in DOM but not in a condition to be interacted. Some of the reasons for this exception are −

There may be a covering of another element on the element with which we want to interact with. This overspread of an element over the other can be temporary or permanent. To resolve a temporary overspread, we can wait for an expected condition for the element.

We can wait for the expected condition of invisibilityOfElementLocated for the overlay element. Or, wait for the expected condition of elementToBeClickable for the element with which we want to interact.


WebDriverWait w= (new WebDriverWait(driver, 7));
. elementToBeClickable ("id of element")));
//alternate solution
. invisibilityOfElementLocated("id of overlay element")));

To resolve a permanent overspread, we can use the JavaScript Executor to perform the click action. Selenium uses the executeScript method to execute JavaScript commands.


WebElement l = driver.findElement("id of element"));
JavascriptExecutor j = (JavascriptExecutor) driver;
j.executeScript("arguments[0].click();", l);


import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.JavascriptExecutor;
public class InteractableExceptionFix{
   public static void main(String[] args) {
      WebDriver driver = new ChromeDriver();
      //launch URL
      //identify element
      WebElement l = driver.findElement(By.xpath("//input[@id='persistent']"));
      //JavascriptExecutor to click element
      JavascriptExecutor j = (JavascriptExecutor) driver;
      j.executeScript("arguments[0].click();", l);
      boolean t = l.isSelected();
      if (t) {
         System.out.println("Checkbox is not checked");
      }else {
         System.out.println("Checkbox is checked");


Updated on: 07-Apr-2021

3K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started