0

We leverage Selenium for our website UI automation test. We establish a lab of 10 machines installed Windows 7 as the only OS. And the automation tests (>800) would be dispatched to those machines evenly once each day. However, we come across below time-out error intermittently among different test cases. At the first glance, it seems to due to timeout when trying to loading and rendering the page. However, when we manually open that page, we never experience that before.

I read through several posts both on the google group and this site, but none of them provides a workaround for my problem. Basically, I am seeking a better way to troubleshoot this timeout exception to find the clear RCA and fix it once for all. I am expecting some switch or verbose logs we can go through. Of course, other suggestions or solutions are appreciated as well.

Below is the timeout error details. You can find version and environment information there.

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)
: 

Wishes,

Jingfei

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
machinarium
  • 631
  • 6
  • 17
  • how you have setup the lab ? are you using sauce labs or grid ? As per my understanding its unable to find certain page elements. That may happen because it is either trying to find those elements even before those are loaded or other possible reason is slow connectivity. did you tried adding wait and **wait.until(ExpectedConditions.visibilityOfElementLocated(By.id()));** for retrieving elements ? – Diptman Nov 03 '17 at 08:41

2 Answers2

0

These kinds of problems can be frustrating. Here are a few of the questions that I try to answer when I'm debugging this kind of problem:

  • Is the timeout exception happening at the same point in your code whenever you encounter this, or is it at different places?
  • Is it always the same action that times out, or different actions? The code may be attempting to take an action on an element that is not yet visible.
  • the same page, or different?
  • is the problem occurring at a particular time of the day, or when there are other activities on the server that would cause the application to slow down?
  • does the code make assumptions about current state of the page? If so, you might want to have a rule for your automation that says always check elements are visible/clickable/enabled before taking some action on them. When those assumptions are wrong, but not checked, you end up getting confusing failures.

My automation framework makes extensive use of WebDriverWait, and I try to include useful messages for the case when the timeout is reached, helping me to isolate the source of the problem

Breaks Software
  • 1,721
  • 1
  • 10
  • 15
  • Answers to your suggestions: 1. Timeout exception does not occur on the same place but across different classes while trying to open the same url which is our cashier page 2. >99% is timeout exception, rarely it is 'no session xxx' (not remember the exactly error message) 3. Same page, unfortunately maybe fortunately 4. No time pattern for the occurrences and whenever the case is dispatched, the machine is dedicated for it, so i don't think there exists such contention 5. No, we just try to open it but fails. It fails among invoking RemoteWebDriver.get(url) – machinarium Nov 04 '17 at 08:27
0

Software Versions :

A closer look at the logs reveals the following about your Test Bed :

  1. Selenium Version : 2.39.0
  2. Chromedriver Version : 2.33
  3. Chrome Version : 61.0

I would suggest you to bump up the Selenium Version to v3.6.0 as in Selenium 3.x a lot of functionalities have been added/upgraded/deprecated with respect to Selenium 2.39.0. Once you are on the recent releases debugging becomes easy for the SO volunteers.

Error Analysis :

A closer look at the error depicts java.lang.AssertionError and org.openqa.selenium.TimeoutException at the same time. I am sure you must be using either JUnit or TestNG for assertion. The first and foremost step would be to cross check the Java version & Junit/TestNG version compatibility. Finally, the TimeoutException compells me to cross check the availability of a certain parameter which is passed as an input argument for Assertion/Validation.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • Can I ask how to upgrade version of Selenium? is it bound to chromedriver? – machinarium Nov 04 '17 at 04:34
  • 1
    good catch @DebanjanB, I agree that upgrading to Selenium 3 could make a difference. machinarium, to upgrade, you would need to download the new version and install it from http://www.seleniumhq.org/download/ – Breaks Software Nov 06 '17 at 12:09