Robotium for Android - solo.searchText () not working -


i'm having problem searchtext() function used robotium.

i'm searching string:

<string name="provisioning_wizard_title_2">service activation wizard (step 2)</string> 

i defined in string xml, , i'm searching way:

activity act=solo.getcurrentactivity();  string string = solo.getstring(act.getresources().getidentifier("provisioning_wizard_title_2", "string", act.getpackagename())); 

it fails when call

asserttrue(solo.searchtext(string)); 

and fails if call:

asserttrue(solo.searchtext("service activation wizard (step 2)")); 

even if string i'm seeing in focused screen activity.

the strange thing works if use same string without last character:

asserttrue(solo.searchtext("service activation wizard (step 2")); 

and works if use

asserttrue(solo.searchtext(string.substring(0, string.length()-1))); 

i hope me.

sorry english!

thank you.

problem solved solved problem renas reda (founder , maintainer of robotium). problem due regex support in searchtext(); characters trigger it. use pattern.quote(string) example: pattern.qoute("provisioning_wizard_title_2") , eveything works good!

i use solo#waitfortext(...) make sure i'm not losing race condition.

try this:

asserttrue(solo.waitfortext( solo.getstring(r.string. provisioning_wizard_title_2) );

make sure importing correct r.java file production project (not test project).


Comments