Android, Robotium - Issue taking screenshot

后端 未结 3 1265
感动是毒
感动是毒 2021-01-15 16:40

I\'m trying to take a screenshot of my Android application using Robotium, I\'m using the below function that I found here.

public static String SCREEN_SHOTS         


        
3条回答
  •  余生分开走
    2021-01-15 17:30

    The reason why you are getting NullPointerException is because you are using getView(int id) incorrectly. As you are giving it an index instead of id, it will not find the view that you are looking for and thus returns null. What you want to use is following:

    takeScreenShot(solo.getViews().get(0), "Test")

    Which means the first view of all the views available to Robotium at a given time.

提交回复
热议问题