solo.sendKey(20); // used for move to next object on screen //
Follow the line above and stop when you focus on the desired button
Then do the following line, click
solo.sendKey(66); // Click On Focused Button //
For example, you have 3 objects on the screen:
[1] username [text box]
[2] password [text box]
[3] Submit [Button]
If you want to click the submit button using robotium then
solo.sendKey(20);// focus on username textbox solo.sendKey(20);// focus on password textbox solo.sendKey(20);// focus on Submit button solo.sendKey(66);// Click On Submit Button
we usually send keyevents from munkey code, so I offer you the code above.
Note:
KEYCODE_DPAD_DOWN [Constant value: 20 (0x00000014)]
KEYCODE_ENTER [Constant value: 66 (0x00000042)]
Insert from http://developer.android.com/reference/android/view/KeyEvent.html
I tested this in my automation application.
Hope this helps you, thanks.
source share