Home > Enterprise >  org.openqa.selenium.ElementNotInteractableException: element not interactable
org.openqa.selenium.ElementNotInteractableException: element not interactable

Time:08-25

My test is failing when it reaches the line below:

driver.findElement(By.id("password")).sendKeys("myPass");

I have tried the solutions given but it still not interactable

CodePudding user response:

This exception can happen when:

  1. Element is not visible.
  2. Element is present in off screen (after scroll down it will display).
  3. Element is present behind any other element.
  4. Element is disabled.

You can try to use Wait and ExpectedConditions:

Wait<WebDriver> = new FluentWait<>(webDriver)
                .withTimeout(Duration.ofSeconds(TIMEOUT))
                .pollingEvery(Duration.ofSeconds(POLLING))
                .ignoring(NoSuchElementException.class); 
   
wait.until(ExpectedConditions.elementToBeClickable(By.id("password"))).click();

or

wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("password"))).click();

CodePudding user response:

1.Now only use Thread.sleep(5000); it may be work otherwise use selenium waits like implicit,explicit and fluent waits

  • Related