5

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.

ezamur
  • 2,064
  • 2
  • 22
  • 39

3 Answers3

3

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); 
Smileek
  • 2,702
  • 23
  • 26
1

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);

s_id
  • 446
  • 3
  • 10
0

You can not use keycode, what you can do is to know the key position and press it. As soft keyboard is a bitmap, not a view.

Geo Zhang
  • 39
  • 4