Question

We are trying to write a test for an Native Android App and this has been driving me nuts.

    solo.enterText(6, "100");
    solo.enterText(7, "200");
    solo.enterText(8, "300");
    solo.enterText(9, "400");

all work fine, but once the index goes over 10 it fails to find any of the fields.

    solo.enterText(10, "500");
    solo.enterText(11, "600");

It also seems a little crazy to be counting the text fields and from within UIAutomator Viewer it does not seem to provide the true index number.

Is there a way to select the text field by resource id or the field name instead of the index number?

thanks for your help

Was it helpful?

Solution 2

My guess is that if you look at the screen you will only be able to see 10 edit text boxes and the edit texts with index 10+ are off the screen and inside a list view so they do not actually exist to robotium, you will need to scroll before you can input text but then the indexs will be off so you will have to compensate. The alternative is to find the edit texts by a different means like id or a tag or to find them as a child of the listview row that they are in.

If you can confirm it is because its in a list view i can find some code to help you.

OTHER TIPS

Try this:

 EditText editText
 =(EditText)getActivity().findViewById(R.id.editText);
 mSolo.enterText(editText,"500");

using R file and id resourse should be easier to test editText

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top