How to click the Search button on a soft keyboard using the Robotium test?

I want to test the following thing with Robotium: enter text in the search field, I did this, and click the "search" button on the soft keyboard (android: imeOptions = actionSearch), which I can not do. I tried with solo.sendKey (Solo.Enter) but did not succeed. I'm not sure if this is important, but the soft keyboard is not shown at all - I also tried to achieve this, but without success.

+5
source share
3 answers

At last! Robotium 5.1 proudly presents to you pressSoftKeyboardSearchButton().

For older versions, you can use this code (not clean enough, but it works):

solo.enterText(0, "ItemToSearchFor");
solo.sleep(1000);
solo.clickInList(0); 
+3
source
+1

You cannot use keycode, what you can do is to know the position of the key and click on it. Because the soft keyboard is a bitmap, not a representation.

0
source

All Articles