Click home icon with Espresso Click home icon with Espresso android android

Click home icon with Espresso


To not depend on the app locale, you can use the code from Matt Logan by replacing "Navigate up" with R.string.abc_action_bar_up_description:

onView(withContentDescription(R.string.abc_action_bar_up_description)).perform(click());

This helped me a lot because I have an app in more than 5 languages and I had to act like this.


Use the withContentDescription() Matcher:

onView(withContentDescription("Navigate up")).perform(click());


I had trouble navigating back from one Activity to another, but then I found top-level actions:

Espresso.pressBack();