Skip to content Skip to sidebar Skip to footer

How To Use R.id In Robotium If I Have Only The Apk File

I want to test an app from play market. I have a problem when I`m trying to use solo.clickOnView(solo.getView(cn.wps.moffice_eng.R.id.writer_edittoolbar_saveBtn)); cn - cn cannot

Solution 1:

As a @Renas suggested, getView(String id) is what you need.

In robotium 5.0.1 you should use just id string, not the whole name. It should look like this:

solo.clickOnView(solo.getView("resourceId"));

Solution 2:

Use getView(String id) which was introduced in robotium 4.2. It should look like this:

solo.clickOnView(solo.getView("cn.wps.moffice_eng.R.id.writer_edittoolbar_saveBtn"));

Solution 3:

The first step is to resign the apk you are going to test.

Then I use scripts like below:

View view = solo.getView(com.test.app.R.id.resourceId);
solo.clickOnView(view);

Post a Comment for "How To Use R.id In Robotium If I Have Only The Apk File"