I have tried a couple of options but I am unable to test the Google Chrome tab url's by android ui-automator. Could someone please help me out here?
I have tried a couple of options but I am unable to test the Google Chrome tab url's by android ui-automator. Could someone please help me out here?
Let's assume on click of a button you're trying to navigate to "https://www.abcd.com/xyz".
(This URL is not valid. This is just a sample)
Steps to follow:
Initialise UiSelector and UiDevice in your test class :
private val select = UiSelector()
private val device =
UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
Click on the button : onView(withId(id)).perform(click())
Find the resource id :
val urlBar = device.findObject(select.resourceId("com.android.chrome:id/url_bar"))
Assert the Navigation : assert(urlBar.text.contains("xyz"))