Getting orgopenqaseleniumElementNotInteractableException element not interactable error | Selenium Forum
S
Sapna Posted on 07/03/2019

I am trying to search a source destination ''London City Arpt' on https://www.phptravels.net/ website and select it.

Below is my code

WebElement sloc = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[@id=' ']//span[1]")));
sloc.click();
sloc.sendKeys(source + Keys.ENTER);

I am getting below error

org.openqa.selenium.ElementNotInteractableException: element not interactable

 

 

 


A
Ashish Thakur Replied on 07/03/2019

This works-

 

 
WebDriver driver = new ChromeDriver();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.get("https://www.phptravels.net");
driver.findElement(By.xpath("//*[@id='s2id_autogen8']/a/span[1]")).click();
driver.findElement(By.xpath("//*[@id='select2-drop']/div/input")).sendKeys("London");
WebDriverWait wait  = new WebDriverWait(driver, 20);
//wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.xpath("//div[text()='London, United Kingdom']")));
Thread.sleep(10000);
// driver.findElement(By.xpath("//div[text()='London, United Kingdom']")).click();
List<WebElement> options = driver.findElements(By.xpath("//div[@class='select2-result-label']"));
System.out.println(options.size());
for(int i=0;i<options.size();i++) {
if(options.get(i).getText().equals("London, United Kingdom")) {
options.get(i).click();
break;
}
}