This Question have no Text answers yet!

AmbiguiousViewMatcException when testing Android app with Espresso

Question!

I am testing one of my Android apps that has a viewpager. The ViewPager has 2 fragments. Both these framents are using the same xml as layout. This xml has a ListView in it.

When I try to lookup the ListView using

onData(anything())
                .inAdapterView(withId(R.id.listview))
                .atPosition(4)
                .perform(click());"

I get an AmbiguiousViewMatcException meaning that I am trying to perform ViewAction on a view whose duplicate has been found by Espresso.

I came across solution where I couldnt identify ListView by passing

           .inAdapterView(withDesciption("desc"))

but as I am using the same xml layout, this is again going to cause the same exception. Any help?

By : jaydeepw


Video about AmbiguiousViewMatcException when testing Android app with Espresso