Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to click on soft keyboard 'search' button with Robotium test?

I want to test next thing with Robotium: enter some text in search field, this I did, and click on soft keyboard 'search' button (android:imeOptions=actionSearch) which I am failing to do. I tried with solo.sendKey(Solo.Enter) but no success. I am not sure if this is important, but soft keyboard is not shown at all - I tried to achieve that somehow but without success, also.

like image 733
ezamur Avatar asked Oct 07 '22 19:10

ezamur


2 Answers

Finally! Robotium 5.1 proudly presents to you pressSoftKeyboardSearchButton().

For older versions you can use this code (isn't clean enough, but works):

solo.enterText(0, "ItemToSearchFor");
solo.sleep(1000);
solo.clickInList(0); 
like image 164
Smileek Avatar answered Oct 12 '22 12:10

Smileek


Have you tried to send this keycode? http://developer.android.com/reference/android/view/KeyEvent.html#KEYCODE_SEARCH something like this

solo.sendKey(KeyEvent.KEYCODE_HOME);

like image 45
s_id Avatar answered Oct 12 '22 10:10

s_id