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

chore: return operation error in handleKeyboardInput #799

Merged
merged 4 commits into from
Oct 29, 2023

Conversation

KazuCocoa
Copy link
Member

@KazuCocoa KazuCocoa commented Oct 28, 2023

Xcode 15 built WDA app without embedded XCTest frameworks raise unrecognized error for this new type of method call.

This PR just returns an explicit unsupported operation error for the case. This is for #797 (comment)

e.;g. for iOS 16

[HTTP] --> POST /session/ba565cf2-f948-4012-b8bd-371d733b59cb/execute/sync
[HTTP] {"script":"mobile: keys","args":[{"keys":["o"]}]}
[debug] [XCUITestDriver@d5ea (ba565cf2)] Calling AppiumDriver.execute() with args: ["mobile: keys",[{"keys":["o"]}],"ba565cf2-f948-4012-b8bd-371d733b59cb"]
[debug] [XCUITestDriver@d5ea (ba565cf2)] Executing command 'execute'
[XCUITestDriver@d5ea (ba565cf2)] Proxying to WDA with an unknown route: POST /wda/element/0/keyboardInput
[debug] [XCUITestDriver@d5ea (ba565cf2)] Proxying [POST /wda/element/0/keyboardInput] to [POST http://127.0.0.1:8100/session/ED3F626B-675C-405E-B9AF-5F20A71FFFB2/wda/element/0/keyboardInput] with body: {"keys":["o"]}
[XCUITestDriver@d5ea (ba565cf2)] Got response with status 500: {"value":{"error":"unsupported operation","message":"Not supported on this OS version","traceback":""},"sessionId":"ED3F626B-675C-405E-B9AF-5F20A71FFFB2"}
[debug] [W3C] Matched W3C error code 'unsupported operation' to UnsupportedOperationError
[debug] [XCUITestDriver@d5ea (ba565cf2)] Encountered internal error running command: UnsupportedOperationError: Not supported on this OS version
[debug] [XCUITestDriver@d5ea (ba565cf2)]     at errorFromW3CJsonCode (/Users/kazu/GitHub/appium-xcuitest-driver/node_modules/@appium/base-driver/lib/protocol/errors.js:1059:25)
[debug] [XCUITestDriver@d5ea (ba565cf2)]     at ProxyRequestError.getActualError (/Users/kazu/GitHub/appium-xcuitest-driver/node_modules/@appium/base-driver/lib/protocol/errors.js:928:14)
[debug] [XCUITestDriver@d5ea (ba565cf2)]     at JWProxy.command (/Users/kazu/GitHub/appium-xcuitest-driver/node_modules/@appium/base-driver/lib/jsonwp-proxy/proxy.js:353:19)
[debug] [XCUITestDriver@d5ea (ba565cf2)]     at runMicrotasks (<anonymous>)
[debug] [XCUITestDriver@d5ea (ba565cf2)]     at processTicksAndRejections (node:internal/process/task_queues:96:5)
[debug] [XCUITestDriver@d5ea (ba565cf2)]     at XCUITestDriver.proxyCommand (/Users/kazu/GitHub/appium-xcuitest-driver/lib/commands/proxy-helper.js:109:35)
[debug] [XCUITestDriver@d5ea (ba565cf2)]     at XCUITestDriver.mobileKeys (/Users/kazu/GitHub/appium-xcuitest-driver/lib/commands/keyboard.js:54:12)
[debug] [XCUITestDriver@d5ea (ba565cf2)]     at XCUITestDriver.executeMethod (/Users/kazu/GitHub/appium-xcuitest-driver/node_modules/@appium/base-driver/lib/basedriver/commands/execute.ts:36:12)
[debug] [XCUITestDriver@d5ea (ba565cf2)]     at XCUITestDriver.execute (/Users/kazu/GitHub/appium-xcuitest-driver/lib/commands/execute.js:118:14)
[HTTP] <-- POST /session/ba565cf2-f948-4012-b8bd-371d733b59cb/execute/sync 500 105 ms - 1179

This is actually not necessary, since WDA just returns unrecognized selector sent to instance 0x28367cd90 like this error message

current:

[XCUITestDriver@b970 (d349bf76)] Proxying to WDA with an unknown route: POST /wda/element/0/keyboardInput
[debug] [XCUITestDriver@b970 (d349bf76)] Proxying [POST /wda/element/0/keyboardInput] to [POST http://127.0.0.1:8100/session/A0EFA110-53DD-4414-8861-6541528E3AAE/wda/element/0/keyboardInput] with body: {"keys":["o"]}
[XCUITestDriver@b970 (d349bf76)] Got response with status 500: {"value":{"error":"unknown error","message":"-[XCUIApplication typeKey:modifierFlags:]: unrecognized selector sent to instance 0x28367cd90","traceback":"(\n\t0   CoreFoundation                      0x000000019c318c50 DF935525-036C-30AE-8D1D-4E5F3DD7876A + 40016\n\t1   libobjc.A.dylib                     0x00000001953b7e5c objc_exception_throw + 60\n\t2   CoreFoundation                      0x000000019c48daa8 DF935525-036C-30AE-8D1D-4E5F3DD7876A + 1567400\n\t3   CoreFoundation                      0x000000019c32f078 DF935525-036C-30AE-8D1D-4E5F3DD7876A + 131192\n\t4   CoreFoundation                      0x000000019c395890 _CF_forwarding_prep_0 + 96\n\t5   WebDriverAgentLib                   0x0000000106e11100 +[FBCustomCommands handleKeyboardInput:] + 1284\n\t6   WebDriverAgentLib                   0x0000000106ddd900 -[FBRoute_TargetAction mountRequest:intoResponse:] + 168\n\t7   WebDriverAgentLib                   0x0000000106dc8264 __37-[FBWebServer registerRouteHandlers:]_block_invoke + 408\n\t8   WebDri...
[debug] [W3C] Matched W3C error code 'unknown error' to UnknownError
[debug] [XCUITestDriver@b970 (d349bf76)] Encountered internal error running command: UnknownError: An unknown server-side error occurred while processing the command. Original error: -[XCUIApplication typeKey:modifierFlags:]: unrecognized selector sent to instance 0x28367cd90
[debug] [XCUITestDriver@b970 (d349bf76)]     at errorFromW3CJsonCode (/Users/kazu/GitHub/appium-xcuitest-driver/node_modules/@appium/base-driver/lib/protocol/errors.js:1059:25)
[debug] [XCUITestDriver@b970 (d349bf76)]     at ProxyRequestError.getActualError (/Users/kazu/GitHub/appium-xcuitest-driver/node_modules/@appium/base-driver/lib/protocol/errors.js:928:14)
[debug] [XCUITestDriver@b970 (d349bf76)]     at JWProxy.command (/Users/kazu/GitHub/appium-xcuitest-driver/node_modules/@appium/base-driver/lib/jsonwp-proxy/proxy.js:353:19)
[debug] [XCUITestDriver@b970 (d349bf76)]     at runMicrotasks (<anonymous>)

@KazuCocoa KazuCocoa merged commit 247ace6 into master Oct 29, 2023
44 of 46 checks passed
@KazuCocoa KazuCocoa deleted the operationerror branch October 29, 2023 22:25
github-actions bot pushed a commit that referenced this pull request Oct 29, 2023
## [5.12.2](v5.12.1...v5.12.2) (2023-10-29)

### Miscellaneous Chores

* return operation error in `handleKeyboardInput` ([#799](#799)) ([247ace6](247ace6))
@github-actions
Copy link

🎉 This PR is included in version 5.12.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants