1

enter image description hereThat tag element

org.openqa.selenium.ElementNotInteractableException: Element is not reachable by keyboard

3
  • 2
    Please get a screenshot to show what exactly is going on. What element? What code is trying to reach it? Please show both the HTML source and also the selenium source. We can't help you without this basic information. Mar 25 '19 at 11:20
  • 1
    that tag element!! Mar 25 '19 at 12:11
  • Please provide more information about your problem, not only screenshots. Describe the exact issue and how you tried to solve the problem without success.
    – MMMM
    Mar 26 '19 at 8:31
3

ElementNotInteractableException

ElementNotInteractableException is the W3C exception which is thrown to indicate that although an element is present on the HTML DOM, it is not in a state that can be interacted with.

Reasons & Solutions :

The reason for ElementNotInteractableException to occur can be numerous.

  1. Temporary Overlay of other WebElement over the WebElement of our interest :

In this case, the direct solution would have been to induce ExplicitWait i.e. WebDriverWait in combination with ExpectedCondition as invisibilityOfElementLocated as folllows:

WebDriverWait wait2 = new WebDriverWait(driver, 10);
wait2.until(ExpectedConditions.invisibilityOfElementLocated(By.xpath("xpath_of_element_to_be_invisible")));
driver.findElement(By.xpath("xpath_element_to_be_clicked")).click();

A better solution will be to get a bit more granular and instead of using ExpectedCondition as invisibilityOfElementLocated we can use ExpectedCondition as elementToBeClickable as follows:

WebDriverWait wait1 = new WebDriverWait(driver, 10);
WebElement element1 = wait1.until(ExpectedConditions.elementToBeClickable(By.xpath("xpath_of_element_to_be_clicked")));
element1.click();

2.Permanent Overlay of other WebElement over the WebElement of our interest :

If the overlay is a permanent one in this case we have to cast the WebDriver instance as JavascriptExecutor and perform the click operation as follows:

WebElement ele = driver.findElement(By.xpath("element_xpath"));
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("arguments[0].click();", ele);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.