How to open Menu Drawer navigation in Android Native app

I have a Native android where I’m not able to open the drawer from any on the internal screen of the app to come back to home screen.
Please tell the way how i can implement this .

@Anshita_Sen pls give a screen example to help

screen one on which when i swipe from left drawer open. I want the way how can i do it using appiumm

screen 2

@Anshita_Sen i do not have problem to open same drawer of gmail client with:

    public void gmailDrawer() {
        MobileElement swipeEl = (MobileElement) driver.findElement("list_view"));
        int startx = swipeEl.getLocation().getX() + 5;
        int starty = swipeEl.getCenter().getY();
        int endx = swipeEl.getSize().getWidth() - 10;
        int endy = 0;

        System.out.println(startx + ", " + starty + " -> " + endx + ", " + endy);
        new TouchAction(driver).press(startx, starty).waitAction(Duration.ofMillis(100)).moveTo(endx, endy).waitAction(Duration.ofMillis(100)).release().perform();


I treid to check the same on gmail drawer to get idea but im not able to find driver.findElement(“list_view”));

I’m using UI automator… Can u please Guide me …

@Anshita_Sen -

Thnks got it. I will try to implement this way in my app.

I tried this code in my app but it is not working for me …instead i have wriiten the below code

public void opendrawer() throws InterruptedException {

            driver.swipe(150, 0, 635, 0, 3000);
       MobileElement Carj = (MobileElement)driver.findElementByAndroidUIAutomator("new UiSelector().text(\"Car Insurance\")");;
       System.out.println("Swipe right");

this only swipes with the given coordinates value and exits but my menu drawer is still not opening . Can u please help me in this …

You can do that using

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

Please check the screenshot.

  1. Kept infinite loop to get main_activity.
  2. Able to find the drawer menu, but drawer menu opening when we run test again.

Before closing the first test, drawer menu shown and closed immediately.

How to open drawer menu once element found and kept open? This page will display after login activity.

Please check the question below and reply.