Wednesday, December 25, 2013

Waiting for all Async calls to complete during Selenium tests

Hello Everyone,

  We are writing integration tests using Selenium Web Driver and Cucumber JVM for our GWT application.

  One major issue that we are facing is how to identify when all the Async calls are complete. We would like to execute the next Step only after all the async calls are complete from the previous step.

  Currently, because there is no control over the same, the test results are in-consistent. Sometimes because the async call from earlier step gets completed during a step we get Selenium's StaleElementReferenceException because of the DOM refresh caused by the async call.

 I have seen posts which mention to use WebDriverwait with a timeout enough to wait for the elements to be located. We are already doing that......That does not solve the problem in a generic manner.

 What I am looking for is a generic solution which will enable me to wait for the completion of all the async calls which I can use in between the steps. This way the test results will be consistent.

 I tried different options like
   - document.readyState to become "complete"
   - != 0 etc.

  But none of these identify whether all the async calls are finished.

  I also saw the post - and am going to try out the same.....

  Is there any tried and tested approach for the same which has been used across GWT applications?

Thanks in advance,

You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment