【发布时间】:2017-12-26 23:49:04
【问题描述】:
代码:
WebElement betting = driver.findElement(By.id("flex-menu"));
List<WebElement> hallo = betting.findElements(By.xpath("//*[@id='flex-menu']//ul//li//a"));
System.out.println(hallo.get(0).getText());
hallo.get(0).click();
错误按摩:
线程“main”中的异常 org.openqa.selenium.ElementNotInteractableException:
会话 ID:4bfaaf77-6275-4ffc-a8d7-b24b70f3acca 在 sun.reflect.NativeConstructorAccessorImpl.newInstance0(本机方法) 在 sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) 在 sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 在 java.lang.reflect.Constructor.newInstance(Constructor.java:422) 在 org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187) 在 org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122) 在 org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49) 在 org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:164) 在 org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83) 在 org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601) 在 org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:279) 在 org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:83) 在 Aufgabe1.Main.main(Main.java:41)
该守则有什么问题?我不能点击,但它找到了元素。
【问题讨论】: