Noffica
Noffica

Reputation: 469

Calabash Android: Is there a special perform_action command for pressing the search button on the Android keyboard

The command perform_action('send_key_enter') sends the enter key but for our search field, the enter key is replaced by the search key in the Android keyboard.

Is there a special perform_action command to send the input of the search key?

Upvotes: 1

Views: 2950

Answers (3)

Noffica
Noffica

Reputation: 469

I have been able to solve this by the following command: press_user_action_button('search')

Source: https://groups.google.com/d/msg/calabash-android/Tl14BqQeWoU/zlxm3hRIpsQJ as part of the v0.5.2 release notes.

Upvotes: 1

lux
lux

Reputation: 8446

What could be happening is your scripts aren't able to accurately locate ADB in order to send the command to the device. Try using the following, which uses default_device.adb_command - this should use the full path to ADB and also use the proper device id:

system("#{default_device.adb_command} shell input keyevent KEYCODE_ENTER")

Also, I can't take credit for this, so go ahead and take a look at this great post which helped me immensely when dealing with entering text:

Upvotes: 1

Mesh
Mesh

Reputation: 193

Try this :   system("adb shell input keyevent KEYCODE_ENTER")

By 'adb shell input keyevent', either an event_code or a string will be sent to the device.

Look into few more Event_code

Please mention your error message if you still face same issue

Upvotes: 0

Related Questions