Prabin Timsina Prabin Timsina - 1 year ago 323
Java Question

Espresso Android matching textviews inside parent

I have a simple linear layout with two textviews inside it. The linear layout has an unique id but the textviews don't have. How do I verify one of the texts is from those textviews?

I tried the following code:


Unfortunately,its not working for me.I am getting the following error: No views in
hierarchy found matching

Answer Source

Use hasDescendant()

onView(withId(, hasDescendant(withText("Available")))));