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

筅森魡賤 提交于 2020-01-03 02:31:09

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!