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:

    @Test
    public void gmailDrawer() {
        MobileElement swipeEl = (MobileElement) driver.findElement(MobileBy.id("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();

        sleep(10);
    }

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

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

@Anshita_Sen - https://screencast.com/t/Qjgj5vu2Cyd

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

@Test(priority=3)
public void opendrawer() throws InterruptedException {

	driver.findElement(By.id("com.policybazaar:id/action_bar_root"));
            driver.swipe(150, 0, 635, 0, 3000);
     
       driver.findElement(By.id("com.policybazaar:id/drawer")).wait(20000);
      
       MobileElement Carj = (MobileElement)driver.findElementByAndroidUIAutomator("new UiSelector().text(\"Car Insurance\")");
	    Carj.click();
       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 …
Thanks

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.