问题
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?
回答1:
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:
- http://krazyrobot.com/2014/02/calabash-android-enter-text-from-keyboard-using-adb/
回答2:
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.
回答3:
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
来源:https://stackoverflow.com/questions/24900172/calabash-android-is-there-a-special-perform-action-command-for-pressing-the-sea