Since espresso 2.2 release, webview support module was added to the lineup silentry.
Unfortunately there is no official documents or sample yet, but it’s already can be used. So I’m gonna show you sample and api usage.
This is just unofficial guide. When official stuff being published, it will become deprecated soon.
The dependency is
Related classes are under the
When it comes to espresso-core, you can write tests like following syntax.
espresso-web also provides similar api design.
You can specify target WebView, DOM element and perform action and check the result of assertion. This is just minimum package, but it’s enough to start.
To specify target element by
withElement(Atom<r>), you can use util methods collection declared in DriverAtoms like
findElement(Locator locator, String value),
findMultipleElements(Locator locator, String value).
To execute web action, you can also use DriverAtoms utils collection.
I found three main methods
webKeys(String text). But they can do only simple web action, so it may be increased in a future release, I guess.
It’s off the subject but dive into the declare of web action(ex. webKeys(String)), I found the following signature.
And go to the
Web.WebInteraction.check gets WebAssersiton as argument.
When developing giant app in work, WebView is kinda “inexorable” stuff. So espresso-web lowers a hurdle to put espresso on your production environment(actually robotium started WebView support from a few years ago…).