Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.5.0-beta8: Android passing pressKeyCode an integer throwing UnsupportedCommandException #5937

Closed
JEKMiles opened this issue Dec 18, 2015 · 6 comments

Comments

@JEKMiles
Copy link

Calling

pressKeyCode(AndroidKeyCode.BACK)

or

pressKeyCode(4)

I've been getting the following:

org.openqa.selenium.UnsupportedCommandException: Parameters were incorrect. We wanted {"required":["keycode","metastate"]} and you sent ["keycode"]
Command duration or timeout: 6 milliseconds
Build info: version: '2.48.2', revision: '41bccdd10cf2c0560f637404c2d96164b67d9d67', time: '2015-10-09 13:08:06'
System info: host: 'MNP-100868.local', ip: '192.168.162.93', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.10.5', java.version: '1.8.0_60'
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities [...]
Session ID: 6b4074bc-a810-43bf-9a89-2f91bbe28a5a
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:647)
    at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
    at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
    at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
    at io.appium.java_client.android.AndroidDriver.pressKeyCode(AndroidDriver.java:127)

As a work around, calling

pressKeyCode(AndroidKeyCode.BACK, AndroidKeyMetastate.META_NUM_LOCK_ON)

(on the assumption that Num Lock won't affect the back button) is working as expected.

@triager triager added the Needs Triage bugs which are not yet confirmed label Dec 18, 2015
@JEKMiles
Copy link
Author

As of beta11 it looks like I'm no longer getting a run time exception; but the functionality isn't there without adding a metastate.

@alewang
Copy link

alewang commented Jan 25, 2016

I have the same stacktrace when using pressKeyCode in Java client's AndroidDriver. I'm running into a BadParametersError on 1.5.0-beta11. Here are the Appium server logs when this command is sent:

[HTTP] --> POST /wd/hub/session/e36479a9-2b9b-45d2-92a9-1d21818889bb/appium/device/press_keycode
[debug] [MJSONWP] Bad parameters: BadParametersError: Parameters were incorrect. We wanted {"required":["keycode","metastate"]} and you sent ["keycode"]
[HTTP] <-- POST /wd/hub/session/e36479a9-2b9b-45d2-92a9-1d21818889bb/appium/device/press_keycode 400 5.326 ms - 98

@alewang
Copy link

alewang commented Jan 25, 2016

As a note, pressKeyCode(AndroidKeyCode.BACK) is working properly on Appium 1.4.16. The Appium server logs for that version show the following:

info: --> POST /wd/hub/session/fa7192f8-8582-42ec-9250-3578bff9f7b2/appium/device/press_keycode {"keycode":4}
info: [debug] Pushing command to appium work queue: ["pressKeyCode",{"keycode":4,"metastate":null}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"pressKeyCode","params":{"keycode":4,"metastate":null}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: pressKeyCode
info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":true}
info: [debug] Responding to client with success: {"status":0,"value":true,"sessionId":"fa7192f8-8582-42ec-9250-3578bff9f7b2"}
info: <-- POST /wd/hub/session/fa7192f8-8582-42ec-9250-3578bff9f7b2/appium/device/press_keycode 200 186.388 ms - 76 {"status":0,"value":true,"sessionId":"fa7192f8-8582-42ec-9250-3578bff9f7b2"}

@TikhomirovSergey
Copy link

The propblem is in 1.5.0-beta11 still.
#6088
appium/java-client#302
appium/dotnet-client#136

@TikhomirovSergey
Copy link

@imurchie
Please close this ticket. This is working now

@imurchie imurchie removed the Needs Triage bugs which are not yet confirmed label Jul 13, 2017
@lock
Copy link

lock bot commented Apr 27, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Apr 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants