Webelement input not interactable (when choosing a specific one from list)
I'm trying to find a specific input and sendkeys to it on this website. I have no problem locating it in the browser's console with for example (//input)[4]
. However, when I'm trying to find it and sendkeys in my IDE (using Java with Selenium) I got the org.openqa.selenium.ElementNotInteractableException: element not interactable* exception. I tried to do it with following methods:
-
With simple findelement and sendkeys:
WebElement ebookAddInput = driver.findElement(By.xpath("(//input)[4]")); ebookAddInput.clear(); ebookAddInput.sendKeys("4");
-
Using list of items to choose specific one:
List<WebElement> allInputs = driver.findElements(By.xpath("//input[@name='commerce-add-to-cart-quantity-input']")); System.out.println(allInputs.size()); allInputs.get(4).sendKeys("4");
In both cases I got the mentioned error. The only way it works is through not specifying which input i want to choose and then there is no error and first input on the website gets filled:
WebElement ebookAddInput = driver.findElement(By.xpath("//input[@name='commerce-add-to-cart-quantity-input']"));
ebookAddInput.clear();
ebookAddInput.sendKeys("4");
Does someone know why is that happening and if theres way to solve it? Will really appreciate the help.
Comments
Post a Comment