我正在使用 WebDriverBackedSelenium 对网站进行自动化测试,但我的代码在 chrome 和 firefox 上运行良好,但在 IE 中出现问题
代码是
WebDriver driver = new ChromeDriver();
String baseUrl = "https://mywebsite.com/";
selenium = new WebDriverBackedSelenium(driver, baseUrl);
selenium.fireEvent("//td[@id='skin_container_logoff']/a/table/tbody/tr/td[2]", "click");
此行给出以下错误
com.thoughtworks.selenium.SeleniumException: JavaScript error (WARNING: The server did not
provide any stacktrace information) Command duration or timeout: 125 milliseconds Build info:
version: '2.18.0', revision: '15704', time: '2012-01-27 15:48:16' System info: os.name: '
Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.6.0_24' Driver info:
driver.version: EventFiringWebDriver Command duration or timeout: 735 milliseconds Build info:
version: '2.18.0', revision: '15704', time: '2012-01-27 15:49:22' System info: os.name:
'Linux', os.arch: 'amd64', os.version: '2.6.32-131.2.1.el6.x86_64', java.version: '1.6.0_26-
rev' Driver info: driver.version: RemoteWebDriver at
org.openqa.selenium.internal.seleniumemulation.SeleneseCommand.apply(SeleneseCommand.java:42)
at org.openqa.selenium.internal.seleniumemulation.Timer.run(Timer.java:39) at
org.openqa.selenium.WebDriverCommandProcessor.execute(WebDriverCommandProcessor.java:145) at
org.openqa.selenium.WebDriverCommandProcessor.doCommand(WebDriverCommandProcessor.java:75) at
com.thoughtworks.selenium.DefaultSelenium.fireEvent(DefaultSelenium.java:210) at
com.example.tests.WebDriverBackedSeleniumEx.fireEvent(WebDriverBackedSeleniumEx.java:103) at
com.example.tests.LoginAdvanceIE.testLoginIE(LoginAdvanceIE.java:48) at
com.thoughtworks.selenium.SeleneseTestCase.runBare(SeleneseTestCase.java:230) Caused by:
org.openqa.selenium.WebDriverException: JavaScript error (WARNING: The server did not provide
any stacktrace information) Command duration or timeout: 125 milliseconds Build info: version:
'2.18.0', revision: '15704', time: '2012-01-27 15:48:16' System info: os.name: 'Windows 7',
os.arch: 'x86', os.version: '6.1', java.version: '1.6.0_24' Driver info: driver.version:
EventFiringWebDriver Command duration or timeout: 735 milliseconds Build info: version:
'2.18.0', revision: '15704', time: '2012-01-27 15:49:22' System info: os.name: 'Linux', os.arch:
'amd64', os.version: '2.6.32-131.2.1.el6.x86_64', java.version: '1.6.0_26-rev' Driver info:
driver.version: RemoteWebDriver at
java.lang.reflect.Constructor.newInstance(Constructor.java:513) at
org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:147) at
org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:113) at
org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:439) at
org.openqa.selenium.remote.RemoteWebDriver.executeScript(RemoteWebDriver.java:353) at
org.openqa.selenium.internal.seleniumemulation.JavascriptLibrary.executeScript(JavascriptLibrary.java
:88) at
org.openqa.selenium.internal.seleniumemulation.FireEvent.handleSeleneseCommand(FireEvent.java:38)
at
org.openqa.selenium.internal.seleniumemulation.FireEvent.handleSeleneseCommand(FireEvent.java:1)
at org.openqa.selenium.internal.seleniumemulation.SeleneseCommand.apply(SeleneseCommand.java:36)
Caused by: org.openqa.selenium.remote.ScreenshotException: Screen shot has been taken Build info:
version: '2.18.0', revision: '15704', time: '2012-01-27 15:49:22' System info: os.name: 'Linux',
os.arch: 'amd64', os.version: '2.6.32-131.2.1.el6.x86_64', java.version: '1.6.0_26-rev' Driver
info: driver.version: RemoteWebDriver at
org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:101) Caused by:
org.openqa.selenium.WebDriverException: JavaScript error (WARNING: The server did not provide any
stacktrace information) Command duration or timeout: 125 milliseconds Build info: version:
'2.18.0', revision: '15704', time: '2012-01-27 15:48:16' System info: os.name: 'Windows 7',
os.arch: 'x86', os.version: '6.1', java.version: '1.6.0_24' Driver info: driver.version: Even
tFiringWebDriver Build info: version: '2.18.0', revision: '15704', time: '2012-01-27 15:49:22'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '2.6.32-131.2.1.el6.x86_64',
java.version: '1.6.0_26-rev' Driver info: driver.version: EventFiringWebDriver at
java.lang.reflect.Constructor.newInstance(Unknown Source) at
org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:147) at
org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:113) at
org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:439) at
org.openqa.selenium.remote.RemoteWebDriver.executeScript(RemoteWebDriver.java:353) at
org.openqa.selenium.support.events.EventFiringWebDriver$2.invoke(EventFiringWebDriver.java:100) at
$Proxy2.executeScript(Unknown Source) at
org.openqa.selenium.support.events.EventFiringWebDriver.executeScript(EventFiringWebDriver.java:208)
at org.openqa.selenium.remote.server.handler.ExecuteScript.call(ExecuteScript.java:54) at
org.openqa.selenium.remote.server.handler.ExecuteScript.call(ExecuteScript.java:1) at
java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at
java.util.concurrent.FutureTask.run(Unknown Source) at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown
Source)
我尝试了 WebDriverWait 但我仍然收到错误消息。