当我尝试发送密钥时,我发现错误
Exception in thread "main" org.openqa.selenium.InvalidElementStateException: {"errorMessage":"Element is not currently interactable and may not be manipulated"...
at main.Main_1.main(Main_1.java:39)
Caused by: org.openqa.selenium.remote.ScreenshotException: Screen shot has been taken...
Caused by: org.openqa.selenium.InvalidElementStateException: {"errorMessage":"Element is not currently interactable and may not be manipulated"...
代码:
driver.get("site url");
wait.until( ExpectedConditions.presenceOfElementLocated(By.name("query")) );
System.out.println(driver.getTitle()); //this line works
driver.findElement(By.name("query")).sendKeys("test"); //error here (Main_1.java:39)
是什么原因?
答案 0 :(得分:0)
首先单击该元素:
driver.findElement(By.name("query")).click();
然后使用sendKeys
传递数据:
driver.findElement(By.name("query")).sendKeys("test");