Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Keyevent no longer used for Appium 1.0.0.3? Error when trying to automate tapping device menu button

546 views
Skip to first unread message

Cameron S.

unread,
May 28, 2014, 2:04:34 PM5/28/14
to appium-...@googlegroups.com
I'm using ruby for this script and it breaks whenever I try to automate pressing the device menu button..

@driver.execute_script('mobile: keyevent', :keycode=> 82) # click android menu button

Here's the log I got from it:
> info: Tried to execute non-existent mobile command 'keyevent'
> ERROR: debug: Request received with params: {"script":"mobile: keyevent","args":[{"keycode":82}]}
> POST /wd/hub/session/53e4ae87-dfd8-4935-8b77-c7c56df3ae21/execute 501 1ms - 180b
> ERROR: debug: Appium request initiated at /wd/hub/session/53e4ae87-dfd8-4935-8b77-c7c56df3ae21/screenshot
> ERROR: debug: Request received with params: {}

bootstrap online

unread,
May 28, 2014, 2:06:18 PM5/28/14
to Cameron S., appium-...@googlegroups.com
In the new bindings it's key_event 82
> --
> http://appium.io
> ---
> You received this message because you are subscribed to the Google Groups
> "Appium-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to appium-discus...@googlegroups.com.
> Visit this group at http://groups.google.com/group/appium-discuss.
> For more options, visit https://groups.google.com/d/optout.

Cameron S.

unread,
May 28, 2014, 8:39:22 PM5/28/14
to appium-...@googlegroups.com, Cameron S.
Thanks. Unfortunately, I just tried key_event, with and without 'execute_script' and with and without 'mobile' parameter.

I also installed the appium_lib gem, which I didn't use before. I'm still getting issues.

Currently coded:
@driver.execute_script 'mobile: keyevent', 82 # click android menu button

Log:
info: Tried to execute non-existent mobile command 'key_event'
ERROR: debug: Request received with params: {"script":"mobile: key_event","args":[82]}
POST /wd/hub/session/fa9c2e44-4a54-4463-965b-dacb38ea87ee/execute 501 1ms - 180b

bootstrap online

unread,
May 28, 2014, 8:42:11 PM5/28/14
to Cameron S., appium-...@googlegroups.com

Cameron S.

unread,
May 29, 2014, 1:59:00 PM5/29/14
to appium-...@googlegroups.com, Cameron S.
Thank you. Wasn't even thinking it was that obvious. The one thing I was actually missing was switching from initializing to Appium driver instead of Selenium. 

Eric Lerouge

unread,
Sep 3, 2014, 1:11:23 PM9/3/14
to appium-...@googlegroups.com, cameron....@gmail.com
Hello,
I'm trying to simulate a click on the physical Menu button on Android with Appium and Ruby but I don't get it.
It looks like this thread can help me but I can make it work.

My code is :
capabilities =
{
          'appPackage'=> 'com.myapp.demo,
          'appActivity'=> '.MainActivity',
'platformName' => 'Android',
'deviceName' => 'Galaxy S4',
}
@driver = Selenium::WebDriver.for(:remote, desired_capabilities: capabilities, url: server_url)
@browser = Watir::Browser.new @driver
@browser.driver.manage.timeouts.implicit_wait = 30

@driver.find_element(:name, "BANNER").click() #this line is ok, click on BANNER is done
@driver.execute_script('mobile: key_event', :keycode=> 82) #I've got an error telling me that it's not implemented yet...

I've tried to install gem appium_lib but I've got an error (don't know if I need appium_lib) :
ERROR:  Error installing appium_lib:
ERROR: Failed to build gem native extension.

/Users/elerouge/.rvm/rubies/ruby-2.0.0-p481/bin/ruby extconf.rb
Building nokogiri using packaged libraries.
-----
libiconv is missing.  please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.

So thanks a lot if you can help me to click on the Menu !
I'm very new in this area...
Reply all
Reply to author
Forward
0 new messages