Skip to content Skip to sidebar Skip to footer

Robotium For Android - Solo.searchtext () Not Working

I'm having a problem with searchText() function used with Robotium. I'm searching for this string: Service Activation Wizard (Step

Solution 1:

I usually use Solo#waitForText(...) so I make sure I'm not losing some race condition.

Try this:

assertTrue(solo.waitForText( solo.getString(R.string. provisioning_wizard_title_2) );

Make sure you are importing the correct R.java file from your production project (not the test project).

Solution 2:

I'm not sure, what string you are fetching. Try to log it:

Log.d("Debug", "String is: " + string);

you should rather call, here may be another issue related to package as activity may be in another package than main package of application:

Stringstring = solo.getString(act.getResources().getIdentifier(act.getPackageName()+":string/provisioning_wizard_title_2"), null, null));  

You can also get all visible texts, to make sure, what is on the screen:

for(TextView textView : solo.getCurrentViews(TextView.class)) {
    Log.d("DEBUG", "Text on the screen: " + textView.getText().toString());
}

Post a Comment for "Robotium For Android - Solo.searchtext () Not Working"