我正在使用Selenium Webdriver 2.37,当我尝试执行一些Javascript时,会出现此异常:
线程“main”中的异常org.openqa.selenium.WebDriverException:等待evaluate.js加载失败 命令持续时间或超时:10.23秒 构建信息:版本:'2.33.0',修订版:'4e90c97',时间:'2013-05-22 15:32:38' 系统信息:os.name:'Windows 7',os.arch:'amd64',os.version:'6.1',java.version:'1.7.0' 会议ID:28c14139-0a06-4981-93f8-e66b76683deb 驱动程序信息:org.openqa.selenium.firefox.FirefoxDriver 功能[{platform = XP,acceptSslCerts = true,javascriptEnabled = true,browserName = firefox,rotate = false,locationContextEnabled = true,version = 25.0.1,cssSelectorsEnabled = true,databaseEnabled = true,handlesAlerts = true,browserConnectionEnabled = true,nativeEvents = true,webStorageEnabled = true,applicationCacheEnabled = true,takesScreenshot = true}] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 在java.lang.reflect.Constructor.newInstance(Constructor.java:525) 在org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:191) 在org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145) 在org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554) 在org.openqa.selenium.remote.RemoteWebDriver.executeScript(RemoteWebDriver.java:463) 在Work5.SearchTableTest.attempt(SearchTableTest.java:79) 在Work5.SearchTableTest.main(SearchTableTest.java:261) 引起:org.openqa.selenium.remote.ErrorHandler $ UnknownServerException:等待evaluate.js加载失败 构建信息:版本:'2.33.0',修订版:'4e90c97',时间:'2013-05-22 15:32:38' 系统信息:os.name:'Windows 7',os.arch:'amd64',os.version:'6.1',java.version:'1.7.0' 驱动程序信息:driver.version:未知 at .injectAndExecuteScript / r(file:/// C:/Users/Risheek/AppData/Local/Temp/anonymous371750496448119974webdriver-profile/extensions/fxdriver@googlecode.com/components/driver_component.js:8360) at .fxdriver.Timer.prototype.runWhenTrue / g(file:/// C:/Users/Risheek/AppData/Local/Temp/anonymous371750496448119974webdriver-profile/extensions/fxdriver@googlecode.com/components/driver_component.js:392) at .fxdriver.Timer.prototype.setTimeout /< .notify(file:/// C:/Users/Risheek/AppData/Local/Temp/anonymous371750496448119974webdriver-profile/extensions/fxdriver@googlecode.com/components/driver_component.js :386) Java结果:1
我使用的是Windows 7和Firefox 25.01。这是我正在尝试执行的内容
WebElement hiddenLabel = driver.findElement(By.xpath("//*[@id=\"emT:plam5_3\"]/td[1]/label"));
String script = "return document.getElementById('emT:plam5_3').innerHTML";
labels.add((String) ((JavascriptExecutor) driver).executeScript(script, hiddenLabel));
顺便说一下,labels
只是一个String ArrayList
帮助将不胜感激。