Accessing Android Navigation Drawer elements in native app with node

I am trying to get to an element found in the Navigation Drawer of the app. I have been able to open the drawer, but cannot access any of its contents. The element I am trying to access has an id of ‘drawer_item_logout’, but the command .elementById(‘’) is not finding the element. I am not having any luck with the xpath either.

I know from previous web automation experience that sometimes it’s necessary to switch frames in order to access web elements. Is this the case in Android native apps as well, and if so, how do I go about switching focus to the drawer?

In case it’s relevant, we’re using the “NavigationView” widget from the Design Support Library.

I was able to solve this problem by doing the following:

  1. Finding the xpath to the open Navigation Drawer using the Appium tool
  2. Doing a driver.elementByXPath("").click();
  3. Finding the xpath to the link in the drawer that I want to click on, using the Appium tool
  4. Doing a driver.elementByXpath("").click();

Also, I had to put the two commands in two different mocha tests, probably because of needing to wait for the focus to move to the drawer. Not ideal, but at least I have a way to reach the links in the Navigation Drawer.

@Kristin Hi , Can you please tell me how you have opened the Menu drawer in native android app . I have been trying it but not able to get it open through my code.

Navigation drawer can be access using content description which is save in accessibility id. so it can be accessed using

driver.findElementByAccessibilityId("Open navigation drawer").click();