ligi ligi - 1 year ago 197
Android Question

click home icon with espresso

I am trying to click the home icon in some espresso tests via:


this works fine for Android>3.0 - but fails below as appcompat does not seem to use this id for this element then. What is a good approach to do what I want to do?

Answer Source

Use the withContentDescription() Matcher:

onView(withContentDescription("Navigate up")).perform(click());
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download