1

ウェブサイトの自動テストに 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 を試しましたが、まだエラーが発生します。

4

1 に答える 1

0

これが問題かどうかはわかりませんが、javascript のタイムアウトを手動で指定してみてください。

driver.manage().timeouts().setScriptTimeout(30, TimeUnit.SECONDS);
于 2012-07-30T14:42:46.377 に答える