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
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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.
回答2:
You can use the following method to open the drawer using Robotium:
Solo solo = new Solo(getInstrumentation(), getActivity());
solo.setNavigationDrawer(Solo.OPENED);
回答3:
Method 1:
solo.clickOnImageButton(0);
or
Method 2:
solo.setNavigationDrawer(Solo.OPENED);
solo.clickOnActionBarHomeButton();
Both the Methods worked for me.
回答4:
Finally I did it by using Navigation Drawer Name Ex solo.clickOnText("Home");
回答5:
You can open navgation drawer using content description
driver.findElementByAccessibilityId("Open navigation drawer").click();