The right way to open a NavigationDrawer and select items in Robotium

What is the correct way to open NavigationDrawer and select items from a navigation list in Robotium 5.1? I tried

solo.setNavigationDrawer (Solo.OPENED);

clickInList (position);

until they work.

+4
source share
2 answers

If you view the activity of the navigation box with uiautomatorviewer, you may notice that the menu button of the navigation box is the first ImageButton. Thus, you can call up the menu and click on the first element:

solo.clickOnImageButton(0);// open the menu solo.sendKey(KeyEvent.KEYCODE_DPAD_DOWN);// select the first item solo.sendKey(KeyEvent.KEYCODE_DPAD_CENTER);// click the first item

+2
source

solo.clickOnScreen(50, 50); solo.clickOnActionBarHomeButton(); . .

0

Source: https://habr.com/ru/post/1536393/


All Articles