hellofenghao / robotium

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

Unable to perform a search operation using the device soft keyboard search icon. #574

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi Renas,

We are testing an Hybrid application. 
The scenario is we have a Native text box (which is AutoCompleteTextView) where 
in we send the keyword to search along with this there is a cancel button .

As soon as there is focus on the text box the device soft keyboard pops up.
We use this.solo.enterText(searchBarAutoCompleteTextBox, keyword); to send in 
the keyword
And now we want to click the search icon of the device soft keyboard , so we 
used the following different methods:
1.this.solo.sendKey(KeyEvent.KEYCODE_SEARCH);
2.this.solo.sendKey(EditorInfo.IME_ACTION_SEARCH);
3.this.solo.sendKey(Keyboard.KEYCODE_DONE);
4.this.solo.sendKey(Keyboard.KEYCODE_ENTER);
5.this.solo.sendKey(Solo.ENTER);

but none of the above methods helped us.

Can you please provide us your inputs on how we can go about it. This is a 
major blocker for us.

Would appreciate if we get a resolution for this very soon.

Thanks,
Zaid 

Original issue reported on code.google.com by Zaid.I.M...@gmail.com on 28 Jan 2014 at 3:09

GoogleCodeExporter commented 9 years ago
The soft keyboard is not part of the app you're testing and therefore you are 
not allowed to interact with it. This is a limitation in the Android platform. 
You could try if solo. pressSoftKeyboardNextButton() will work for you.  

Original comment by renasr...@gmail.com on 29 Jan 2014 at 5:06

GoogleCodeExporter commented 9 years ago
Well thanks for the above comments. solo.pressSoftKeyboardNextButton() did not 
work out. But this method gave us the clue on how we can press the search icon. 
What we did is:
we created an object of AutoCompleteTextView by getting its id in 
searchBarAutoCompleteTextBox i.e.,
AutoCompleteTextView searchBarAutoCompleteTextBox = 
this.solo.getView(package.id.ID_OF_THE_TEXTBOX);
AutoCompleteTextView.onEditorAction(EditorInfo.IME_ACTION_SEARCH); // this line 
of code could perform a search operation for us.

Thanks,
Zaid 

Original comment by Zaid.I.M...@gmail.com on 29 Jan 2014 at 11:18

GoogleCodeExporter commented 9 years ago
Great to hear. Thanks for the feedback. We'll see if we can add a method like 
this in the next release. 

Original comment by renasr...@gmail.com on 29 Jan 2014 at 11:21

GoogleCodeExporter commented 9 years ago
My pleasure . And great thanks to you, Renas. 

Original comment by Zaid.I.M...@gmail.com on 29 Jan 2014 at 11:37