(Robotium) Action bar up/home button click

前端 未结 3 1002
长发绾君心
长发绾君心 2021-01-06 04:42

I use Robotium as the library for Junit test for my Android application. I wrote some tests which works well. But when I try to write a test for native ActionBar\'s

3条回答
  •  广开言路
    2021-01-06 05:46

    You can click the Up/Home button (that is the first ImageButton element in the activity) by using the following code:

    solo.clickOnImageButton(0);
    instrumentation.waitForIdleSync();
    

提交回复
热议问题