0

当我尝试发送密钥时,我得到一个错误

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)

是什么原因?

4

1 回答 1

0

首先单击该元素:

driver.findElement(By.name("query")).click();

然后通过使用传递数据sendKeys

driver.findElement(By.name("query")).sendKeys("test");
于 2019-08-21T07:31:17.393 回答