Menu(Hamburger icon) items selection in Mobile app

Hi all,

Using:
io.appium java client 6.1.0
selenium-java 3.14.0
guava 26.0-jre
UIAutomator2
on Oreo and Marshmallow.

I too am working on an app having hamburger menu on a landing page.
Sometimes the element in Hamburger Menu does not get identified. On investigating further, I found out that the xml skeleton of the app UI does not get updated with the hamburger menu elements after the hamburger menu button is clicked in the landing page of the app.

How I identified this ?:

  1. During script run - tried
    xmlFormat = driver.getPageSource();
    if(xmlFormat.contains(“Logout”)){
    //do something
    }
  2. Using UIAutomatorViewer.bat
  3. Using Appium 1.6.2.907

Same is the behavior even after waiting for 1 to 2 minutes and retrying.