Android Robotium: how to go back to my Activity under test after clicking/launching another Activity

后端 未结 2 895
臣服心动
臣服心动 2021-01-20 19:00

I have an issue with my Robotium tests. On one of my Activity A, I am clicking on a button. Clicking on this button launches another activity B. So in my robotium test I hav

相关标签:
2条回答
  • 2021-01-20 19:16

    Once you call any activity outside your application, it’s not possible to come back to your application using solo.<any API>, because solo is tight to UID of your application and doesn't work on other app's activity (with different UID).

    Basically solo can only work on activities which belong to the application for which it’s created.

    0 讨论(0)
  • 2021-01-20 19:27

    Please try methods like

    solo.clickOnView(R.id.myBtn)
    

    to click on your button You can also try

    solo.clickOnButton()
    

    To go back to activity you can use

    solo.goBack();
    

    or

    solo.goBackToActivity("ActivityName");
    
    0 讨论(0)
提交回复
热议问题