我们利用Selenium进行网站UI自动化测试。我们建立了一个由10台机器组成的实验室,将Windows 7作为唯一的操作系并且自动化测试(> 800)将每天均匀地发送到那些机器一次。但是,我们在不同的测试用例中间歇性地遇到了下面的超时错误。乍一看,似乎是由于尝试加载和呈现页面时超时。但是,当我们手动打开该页面时,我们以前从未体验过。
我在谷歌小组和本网站上阅读了几个帖子,但没有一个提供我的问题的解决方法。基本上,我正在寻找一种更好的方法来解决此超时异常,以找到明确的RCA并一劳永逸地修复它。我期待一些我们可以通过的交换机或详细日志。当然,也可以欣赏其他建议或解决方案。
以下是超时错误详情。您可以在那里找到版本和环境信息。
java.lang.AssertionError: org.openqa.selenium.TimeoutException: timeout
(Session info: chrome=61.0.3163.100)
(Driver info: chromedriver=2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 30.93 seconds
Build info: version: '2.39.0', revision: '14fa800511cc5d66d426e08b0b2ab926c7ed7398', time: '2013-12-16 13:18:38'
System info: host: 'v244023117ZzttZ', ip: '10.244.23.117', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_67'
Session ID: 0dd88a079e79fe8da9cc950ebf07e535
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{platform=XP, acceptSslCerts=true, javascriptEnabled=true, browserName=chrome, chrome={userDataDir=C:\Users\ADMINI~1\AppData\Local\Temp\scoped_dir3804_7174, chromedriverVersion=2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f)}, networkConnectionEnabled=false, unexpectedAlertBehaviour=, rotatable=false, setWindowRect=true, locationContextEnabled=true, mobileEmulationEnabled=false, version=61.0.3163.100, pageLoadStrategy=normal, takesHeapSnapshot=true, databaseEnabled=false, cssSelectorsEnabled=true, handlesAlerts=true, browserConnectionEnabled=false, nativeEvents=true, webStorageEnabled=true, hasTouchScreen=false, applicationCacheEnabled=false, 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)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:193)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554)
at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:276)
at com.hhop.bbs.base.ATSWebDriver.open(ATSWebDriver.java:827)
at com.hhop.bbs.fancytest.channel.method.AbstractIPaymentMethod.renderCashier(AbstractIPaymentMethod.java:49)
at com.hhop.bbs.fancytest.channel.method.AbstractIPaymentMethod.doPayment(AbstractIPaymentMethod.java:84)
at com.hhop.bbs.fancytest.actions.channel.TradePaymentAction.fire(TradePaymentAction.java:42)
at com.hhop.bbs.fancytest.testflow.DefaultProcessDriver.driver(DefaultProcessDriver.java:35)
at com.hhop.bbs.fancytest.testflow.DefaultProcessDriver$$FastClassBySpringCGLIB$$11355ca6.invoke()
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:700)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.invoke(AfterReturningAdviceInterceptor.java:51)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:633)
at com.hhop.bbs.fancytest.testflow.DefaultProcessDriver$$EnhancerBySpringCGLIB$$429c9f75.driver()
at com.hhop.bbs.fancytest.testflow.TestFlowEngine.runFailFastMode(TestFlowEngine.java:85)
at com.hhop.bbs.fancytest.testflow.TestFlowEngine.execute(TestFlowEngine.java:58)
at com.hhop.bbs.fancytest.actions.comm.AbstractParentFlowExecuteAction.executeParentFlow(AbstractParentFlowExecuteAction.java:44)
at com.hhop.bbs.fancytest.actions.channel.TradeRefundPrepareAction.prepareForParentFlow(TradeRefundPrepareAction.java:51)
at com.hhop.bbs.fancytest.actions.comm.AbstractParentFlowExecuteAction.fire(AbstractParentFlowExecuteAction.java:27)
at com.hhop.bbs.fancytest.testflow.DefaultProcessDriver.driver(DefaultProcessDriver.java:35)
at com.hhop.bbs.fancytest.testflow.DefaultProcessDriver$$FastClassBySpringCGLIB$$11355ca6.invoke()
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:700)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.invoke(AfterReturningAdviceInterceptor.java:51)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:633)
at com.hhop.bbs.fancytest.testflow.DefaultProcessDriver$$EnhancerBySpringCGLIB$$429c9f75.driver()
at com.hhop.bbs.fancytest.testflow.TestFlowEngine.runFailFastMode(TestFlowEngine.java:85)
at com.hhop.bbs.fancytest.testflow.TestFlowEngine.execute(TestFlowEngine.java:58)
at com.hhop.bbs.fancytest.testflow.LinkTestBase.run(LinkTestBase.java:155)
at com.hhop.bbs.testcase.channel.TradeInSaleFxRefundTestGroup2.doRefund(TradeInSaleFxRefundTestGroup2.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:691)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:883)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1208)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:758)
at org.testng.TestRunner.run(TestRunner.java:613)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.access$000(SuiteRunner.java:37)
at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:368)
at org.testng.internal.thread.ThreadUtil$CountDownLatchedRunnable.run(ThreadUtil.java:165)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
:
愿望,
Jingfei
答案 0 :(得分:0)
这些问题可能令人沮丧。以下是我在调试此类问题时尝试回答的一些问题:
我的自动化框架广泛使用WebDriverWait,并且在达到超时时尝试包含有用的消息,帮助我隔离问题的根源
答案 1 :(得分:0)
仔细查看日志会显示以下关于 Test Bed
的信息:
Selenium Version
:2.39.0 Chromedriver Version
:2.33 Chrome Version
:61.0 我建议你将Selenium Version
提升为 v3.6.0
,如 Selenium 3.x
,添加了许多功能/升级/弃用 Selenium 2.39.0
。一旦你在最近的版本中,SO志愿者的调试变得容易。
仔细查看错误会同时描述 java.lang.AssertionError
和 org.openqa.selenium.TimeoutException
。我确信您必须使用 JUnit
或 TestNG
进行断言。第一步也是最重要的一步是交叉检查 Java
版本& Junit
/ TestNG
版本兼容性。最后, TimeoutException
会让我通过交叉检查某个参数的可用性,该参数作为 Assertion
/ 的输入参数传递Validation
强>