namjae / robotium

Automatically exported from code.google.com/p/robotium
0 stars 0 forks source link

clickLongOnText fails when using uncommon characters #52

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Make an App with clickable text: "Li$t wit% ch\" without ". maybe this step 
is not needed to reproduce the exception.
2. Make an Test-App with test case that uses mSolo.clickLongOnText("Li$t wit% 
ch\\");
3. Run the test case and there will be an exception:

java.util.regex.PatternSyntaxException: Syntax error 
U_REGEX_BAD_ESCAPE_SEQUENCE near index 13:
Li$t wit% ch\
^
at com.ibm.icu4jni.regex.NativeRegEx.open(Native Method)
at java.util.regex.Pattern.compileImpl(Pattern.java:264)
at java.util.regex.Pattern.<init>(Pattern.java:239)
at java.util.regex.Pattern.compile(Pattern.java:179)
at com.jayway.android.robotium.solo.Clicker.clickOnText(Clicker.java:252)
at com.jayway.android.robotium.solo.Solo.clickLongOnText(Solo.java:817)
...

What is the expected output? What do you see instead?
I want the text to be long clicked :-)

What version of the product are you using? On what operating system?
I am using robotium 2.0.2 on Win 7 - 64 bit
tested on Android 1.5 / 2.3 with emulator

Please provide any additional information below.

Original issue reported on code.google.com by finalJus...@googlemail.com on 29 Dec 2010 at 11:02

GoogleCodeExporter commented 9 years ago
Hi,

If you want to click or search for strings with special characters or symbols 
you need to add \\ before them. This is due to the regex support that is 
included into the click and search methods. If you add \\ before them it will 
work. 

/Renas 

Original comment by renasr...@gmail.com on 29 Dec 2010 at 1:50

GoogleCodeExporter commented 9 years ago
To clarify you need to add \\ before the special charachters and symbols. An 
example of how it should look like:

clickLongOnText("Li\\$t wit\\% ch\\\");

Original comment by renasr...@gmail.com on 29 Dec 2010 at 2:49

GoogleCodeExporter commented 9 years ago
thanks for the response!!! that was very helpful. now it works and "searchText" 
seems to work too. thanks!!! 

Original comment by finalJus...@googlemail.com on 30 Dec 2010 at 7:55