1

Tools :

Selenium 3

Issue :

I am running an existing Selenium test case and I am new to Selenium. When the test runs , I can see a component being rendered as below on mozilla using page source :

<input type="text" autocomplete="off" id="home.name" name="home.locator.name" size="20" maxlength="64" value="">

Still after running test through command line , selenium throws below error -

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

I have also tried adding delay as per below but it seems it is not working.

 WebDriverWait wait = new WebDriverWait(getDriver(), 120);
 wait.until(ExpectedConditions.visibilityOf(getDriver().findElement(By.id("home.name")))); 

Can anybody please guide why is this behaviour observed ?

Please note that I am running tests through gradle and command line

Atul
  • 1,560
  • 5
  • 30
  • 75
  • The element seems to be not visible or disabled. Please enable the element and then work afterwards. Can you see if there is a `display` property set to `none` or if it's an Angular web-page , is `ng-show` set to false. – demouser123 Apr 27 '18 at 11:55
  • This is simple web page with no Angular. There is no display property. Element is also visible on UI – Atul Apr 27 '18 at 12:01

1 Answers1

1

Selenium WebDriver uses the native methods of browsers to interact with the web elements. However, some times the web elements do not respond to these native methods. In such cases, your best bet is Java Script.

Please use the following JavaScript to interact with the web element -

WebElement element = driver.findElement(By.id("home.name");

((JavascriptExecutor)driver).executeScript("arguments[0].click();",element);

Note that here I have used the "click" method on the element. However, you can replace it with the method of your choice.