mardi 18 août 2015

Make Espresso wait for WebView to finish loading

Is there a reliable way to make Espresso wait for WebViews to finish loading?

I've tried the approach outlined here but found it unreliable. It also has other drawbacks:

  • It relies on replacing the WebView's WebChromeClient. Any existing WebChromeClient can't be wrapped either, since WebView doesn't have a getWebChromeClient() method for some reason.
  • It requires a specific WebView instance, so every time I start an Activity with a WebView I have to get the WebView instance and register a new WebviewIdlingResource for it.

I'm hoping someone has a solution without any of these drawbacks. I had hopes that the espresso-web package might provide a solution, but it doesn't appear to offer anything relating to loading.

Aucun commentaire:

Enregistrer un commentaire