Prabin Timsina Prabin Timsina - 2 years ago 393
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")))));
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download