Using espresso driver when app switches to browser

The app I’m testing throws off to a browser window for log in then returns to the app. I need to be able to go through this flow using the espresso driver as the app is written with Jetpack Compose. When the browser popup is displayed I get a 500 error in the logs with the error: androidx.test.espresso.NoActivityResumedException: No activities in stage RESUMED. Did you forget to launch the activity

I think I’ve read that the espresso driver is unable to interact with other apps, in this case the browser window. Is this correct? If so, is there any workarounds that anyone’s found? I imagine this situation is reasonably common.

There is a limited support of uiautomator in the driver. You could try to handle the alert by the mobile extension above.

1 Like

Thanks. I can get the page source using mobile:uiautomatorPageSource. However, this only returns native elements. It doesn’t give me anything to to with the html content within the browser.

I can interact with the native elements in the browser using mobile:uiautomator and then using a locator strategy and action - for example I can click on the url bar. But without the page source returning the content of the page in the browser I am unable to interact with the elements such as username and password.

Is it expected that we will not be able to interact with html content?

uiautomator only exposes what the app itself or the web view makes available to the accessibility layer. There is no magic. Make sure your html page is properly accessible.

1 Like