I am not sure which elements will throw this exception.In general is there any method other than providing - a page load time out , implicit, explicit or frequent wait for a particular element .

  • While execution my testcases does not move, it just stay idle and do not throw any exception even. This leaves many browser windows open – testerAutomation Aug 9 '19 at 19:36
  • What have you tried so far? – João Farias Aug 9 '19 at 19:54
  • I have added different types of wait commands for elements, But some elements take long time to respond(may be a failure as well) .In that case I want the test to be failed and move further. My tests are in @Test and , I have given teardown(to close browser) in afterClass method. – testerAutomation Aug 9 '19 at 19:56

Depending on the unit test framework which you are using - there are timeout attributes/annotations. E.g.

  • [Timeout] in NUnit
  • @Test(timeout=1000) in JUnit

In overall it's not a good practice since instead of resolving the root cause of the issue, you'll use the workaround. Your overall test execution time would increase (due to the use of timeouts), while the pass rate would be still low.

| improve this answer | |
  • Thanks, I had to debug all the testcases to find the root cause. I have decided to use timeout attribute for a workaround for some , so that I can run them for now. – testerAutomation Aug 13 '19 at 13:16

Depending on your infrastructure and libraries you're using:

  1. Plain java: ExecutorService has invokeAll() and invokeAny() functions taking timeout as one of the arguments.
  2. There is @Timeable annotation in jcabi-aspects project which limits method execution time to the desired value
  3. In JUnit there is timeout parameter which can be passed to @Test annotation
  4. In TestNG there is timeOut parameter which can be passed to @Test annotation
| improve this answer | |
  • For now I decided to go with Timeout attribute. but in long term I am debugging all the testcases – testerAutomation Aug 13 '19 at 13:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.