I wanna to access (click) an element that is in deeper hierarchies (I don't know if this concept is correct but is how I can explain) but even using xpath, I can't reach them. Using Espresso test recorder, i could get the names of the element and parent class, in this little method:
ViewInteraction percentRelativeLayout = onView(
allOf(withClassName(is("android.support.percent.PercentRelativeLayout")),
withParent(withId(R.id.drawer_activity_navigation_header)),
isDisplayed()));
percentRelativeLayout.perform(click());
I've tried using xpath with hierarchy (classname[@index = 'x']/classname[@index = 2]) but doesn't worked. How can I acess these kind of element?