I have a button in an mdl-card of an html page that looks like this:
<div class="mdl-layout-spacer"></div> <a id="btn15-minutos" href="#/" class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored dialog-button">Comprar</a>
I have an android application that accesses this page using the BrowserView component. I'm using espresso to perform automated testing on this app, and I need to have the button on this page clicked inside the webview, and for that I used the following codes:
onWebView().perform(script("return document.getElementById(\"btn15-minutos\").click()"));
and
onWebView(withId(R.id.webview)).withElement(findElement(Locator.ID, "btn15-minutos")).perform(webClick());
But both are having the same error:
java.lang.RuntimeException: java.util.concurrent.TimeoutException: Timeout waiting for task.
And on Android Monitor:
I / ViewInteraction: Performing 'Evaluate Atom: android.support.test.espresso.web.model.TransformingAtom@869757 in window: null with element: null 'action on view with id: com.project.android:id/webview
Does anyone know of a solution or have you experienced this? Thanks