2

I have a web view which loads another web view with in. The structure follows as below:

  • Web view (name_1)
    • View
    • View
    • Web view (No Name)

Going through the UI test I end up needing to click an element in the inner web view after it gets created. As it doesn't have a name, how am I able to access that web view to click the element?

Usually I would do the below using the named web view as an example

 onWebView(R.id.name_1)
            .withNoTimeout()
            .withElement(findElement(...))
            .perform(webClick())

1 Answers1

2

I would try to use allOf and isDescendantOfA to get the child WebView.

Try this:

onWebView(allOf(
        withClassName(containsString(WebView.class.getSimpleName())),
        isDescendantOfA(withId(R.id.name_1)))
).withNoTimeout().withElement(findElement(...)).perform(webClick());
jeprubio
  • 14,400
  • 5
  • 32
  • 47