sangmingming / robotium

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

text not found when Software Keyboard is shown #85

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. call Solo.searchText("someText")
2. call Solo.clickOnEditText(index)
3. call Solo.searchText("someText")
4. call Solo.searchText("someText", 0, false, true)

What is the expected output? What do you see instead?
expected:
1. found text
3. found text
4. found text
instead:
1. found text
3. not found
4. not found

What version of the product are you using? On what operating system?
2.2

Please provide any additional information below.
The Software Keyboard is shown when an EditText is clicked. This 
prevents Robotium to find a text that is shown.

Original issue reported on code.google.com by JoaRe...@gmail.com on 9 Mar 2011 at 11:43

GoogleCodeExporter commented 9 years ago
Does the keyboard prevent the text from being shown?

Original comment by renasr...@gmail.com on 9 Mar 2011 at 12:49

GoogleCodeExporter commented 9 years ago
No.

In fact in step 2, after I clicked on the EditText a Toast is displayed with 
"someText" above the Software Keyboard.

Original comment by JoaRe...@gmail.com on 9 Mar 2011 at 12:55

GoogleCodeExporter commented 9 years ago
The problem is that the toast takes focus and the text view from the toast is 
what Robotium gets from the platform. 

Try to use waitForText() instead. In that case it will wait longer for the 
toast to dissappear and the other other text view to be active again.

Original comment by renasr...@gmail.com on 9 Mar 2011 at 1:25

GoogleCodeExporter commented 9 years ago
No the Toast has the text I search for.

When the Software Keyboard is displayed, then the Toast is not found neither 
with waitForText() nor with searchText()

Screenshot:
http://img13.imageshack.us/img13/8351/toastzf.png

Original comment by JoaRe...@gmail.com on 9 Mar 2011 at 2:27

GoogleCodeExporter commented 9 years ago
In searchText(text), text is treated as a regular expression and the special 
characters in the toast can be behind the problem that you are experiencing. 
Try to do something like solo.searchText("Mengen.*") when the toast is shown 
instead.

If that does not work try for(TextView textView: solo.getCurrentTextViews()) 
Log.d("Robotium, "text: " + text.getText()); And please tell me what you see in 
the log. 

Original comment by renasr...@gmail.com on 9 Mar 2011 at 2:41

GoogleCodeExporter commented 9 years ago
solo.searchText("Mengen kleiner") returned true.

I can live with that. Thank you very much.

Original comment by JoaRe...@gmail.com on 9 Mar 2011 at 2:48

GoogleCodeExporter commented 9 years ago
You are welcome. I am glad that it is working for you now.

Original comment by renasr...@gmail.com on 9 Mar 2011 at 2:54