Android WebView Tester
http://www.viralandroid.com/2021/08/android-webview-tester.html
Android tool to automate interaction with web pages displayed in Android WebViews. Could be especially helpful in testing UI with Espresso.
So far it provides methods to:
- get value
- set value
- set checked state
- click on element
- pick one of items from <select>
- get inner HTML
All mentioned methods find element either by its id, name or className. When there are more elements returned by name or className selector, we can use additional index parameter.
Methods allow to use callbacks which will be executed after method ends.
Works on Android KitKat and above. WebView has to have JavaScript support enabled.
Download
Library dependency
dependencies {
compile 'com.azimolabs.webviewtester:webviewtester:0.1'
}
Java code
If you don't want to add another dependency to your project, just copy WebViewTester.java class to your source directory.
Examples of usage are shown in sample application.
Download complete project source code from GitHub