'Android Espresso: How do I inspect elements inside a web view?
In the app is a Checkout.com 3DS screen and when I use Layout Inspector (Android Studio), I only see the web view but it has no subtrees. Do I need to use separate software to inspect elements in chrome web view?
I believe I have the correct code to interact with the elements but I'm just guessing the attributes at the moment and not having much luck. Using text/placeholder hasn't worked so far.
private val webView = withId(R.id.verifyByThreeDsWebView)
override fun isDisplayed() {
support.waitForViewDisplayed(webView, 20000)
}
fun enterPassword(password: String = "Checkout1!") {
onWebView(webView).forceJavascriptEnabled()
.withElement(findElement(Locator.XPATH,"//*[@placeholder='Hint: Checkout1!']"))
.perform(webKeys(password))
}
fun clickSubmit() {
onWebView(webView)
.withElement(findElement(Locator.XPATH,"\"//button[contains(text(),'Continue')]\""))
.perform(webClick())
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
