How to open the navigation box menu in automation Robotium script in android

I have an application with a navigation box. I want to open the drawer menu in Automation Robotium. script.my. The minimum Api level is 11, so I use sherlock for the action bar to implement the action bar. Please guide me correctly.

+2
source share
4 answers

Finally, I did this using the Ex navigation box name solo.clickOnText("Home");

+1
source

none of the methods mentioned in the documentation work. The best option is to scroll right.

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.

+2
source

You can use the following method to open a box using Robotium:

Solo solo = new Solo(getInstrumentation(), getActivity());
solo.setNavigationDrawer(Solo.OPENED);
+1
source

Method 1 :

solo.clickOnImageButton(0);

or

Method 2 :

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

Both methods worked for me.

0
source

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


All Articles