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:
- Element is not visible.
- Element is present in off screen (after scroll down it will display).
- Element is present behind any other element.
- 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