1

I have a application with navigation drawer i want to open the drawer menu in Robotium automation script.my application minimum Api level is 11 so i am using action bar sherlock for action bar implementation. Please guide me in right way

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Rakki s
  • 1,426
  • 1
  • 18
  • 42
  • solo.clickOnScreen(50, 50); works. Please refer [this answer][1] [1]: http://stackoverflow.com/questions/15835809/robotium-action-bar-up-home-button-click/23150545#23150545 – Yuchao Zhou May 28 '15 at 18:44

5 Answers5

3

none of the methods mentioned in documentation seem to work. Best option is to swipe rightwards

private void swipeToRight() {
        Display display = solo.getCurrentActivity().getWindowManager().getDefaultDisplay();
        int width = display.getWidth();
        int height = display.getHeight();
        float xStart = 0 ;
        float xEnd = width / 2;
        solo.drag(xStart, xEnd, height / 2, height / 2, 1);
    }

This will do this trick.

Ankit
  • 4,426
  • 7
  • 45
  • 62
1

You can use the following method to open the drawer using Robotium:

Solo solo = new Solo(getInstrumentation(), getActivity());
solo.setNavigationDrawer(Solo.OPENED);
Rodrigo Borges
  • 474
  • 3
  • 10
1

Finally I did it by using Navigation Drawer Name Ex solo.clickOnText("Home");

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Rakki s
  • 1,426
  • 1
  • 18
  • 42
1

Method 1:

solo.clickOnImageButton(0);

or

Method 2:

solo.setNavigationDrawer(Solo.OPENED);
solo.clickOnActionBarHomeButton();

Both the Methods worked for me.

Niks03
  • 11
  • 3
0

You can open navgation drawer using content description

driver.findElementByAccessibilityId("Open navigation drawer").click();
Sajid Zeb
  • 1,806
  • 18
  • 32