"Timeout waiting for task." when trying to click webview button with espresso android

1

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

    
asked by anonymous 12.08.2016 / 19:27

1 answer

1

Problem solved, had modified the getUrl function of BrowserView and as espresso uses this method in OnWebView , it could not find / click on button of webview .     

26.08.2016 / 18:52