如何使用Arquillian Graphene持续测试AJAX?

时间:2013-01-23 21:29:20

标签: ajax firefox junit jboss-arquillian

我正在使用WebDriver运行Arquillian Graphene(2.0.0.Alpha3),结果不一致。有时,我的JUnit测试会毫无问题地通过,有时我会得到这样的错误:

12:13:29.667 WARN - Exception thrown
org.openqa.selenium.WebDriverException: ReferenceError: Graphene is not defined
Command duration or timeout: 946 milliseconds
Build info: version: '2.28.0', revision: '18309', time: '2012-12-11 20:21:18'
System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.6.0_30'
Session ID: 6dce0406-d50d-46d9-8e28-01f159a593b7
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{platform=XP, acceptSslCerts=true, javascriptEnabled=true, browserName=firefox, rotatable=false, locationContextEnabled=true, version=10.0.12, cssSelectorsEnabled=true, databaseEnabled=true, handlesAlerts=true, nativeEvents=true, webStorageEnabled=true, applicationCacheEnabled=true, takesScreenshot=true}]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:187)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:533)
    at org.openqa.selenium.remote.RemoteWebDriver.executeScript(RemoteWebDriver.java:441)
    at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.openqa.selenium.support.events.EventFiringWebDriver$2.invoke(EventFiringWebDriver.java:101)
    at $Proxy1.executeScript(Unknown Source)
    at org.openqa.selenium.support.events.EventFiringWebDriver.executeScript(EventFiringWebDriver.java:209)
    at org.openqa.selenium.remote.server.handler.ExecuteScript.call(ExecuteScript.java:55)
    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 org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:167)
    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)

似乎请求保护会发生大多数问题。例如:

guardXhr(_acceptButton).click();

可能是什么原因?有没有办法调试或解决问题?

1 个答案:

答案 0 :(得分:1)

这被证实是2.0.0.Alpha3中的错误:ARQGRA-262

修复程序可用,似乎可以使用最新的2.0.0.Beta1-SNAPSHOT。