Skip to content

Instantly share code, notes, and snippets.

@wswebcreation
Created July 12, 2018 05:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wswebcreation/6ac27598718eb001cd208dd691db2a84 to your computer and use it in GitHub Desktop.
Save wswebcreation/6ac27598718eb001cd208dd691db2a84 to your computer and use it in GitHub Desktop.
`An unknown server-side error occurred while processing the command` while sending text to an iOS simulator

Issue:

Typing text into an input text element on an iOS simulator with webdriver.io and Appium is causing an error like this

An unknown server-side error occurred while processing the command. Original error: An unknown server-side error occurred while processing the command.

The result is a failing test.

The command

The command is very simple, just this $('~test-Stel hier je vraag.').setValue('Ben je er?')

The cause

After diving into the logs of webdriver.io, see webdriver.io.log, and Appium, see appium.log, I saw out that Appium was telling me the following

Got response with status 200: {"value":"Error Domain=com.facebook.WebDriverAgent Code=1 \"Keyboard is not present\" UserInfo={NSLocalizedDescription=Keyboard is not present}","sessionId":"15326722-C363-4CA0-B4D8-899E9077F830","status":13}

Solution

The solution was simple. My simulator didn't show the keyboard when interacting with the input element. After going to Simulator > Hardware > Keyboard > Toggle software keyboard and enabling the software keyboard the problem was gone.

[07:04:25] COMMAND POST "/wd/hub/session/c5d34971-6a95-47cb-9c92-e7e807061c14/element"
[07:04:25] DATA {"using":"accessibility id","value":"test-Stel hier je vraag."}
[07:04:25] RESULT {"ELEMENT":"CC000000-0000-0000-3A0C-000000000000"}
[07:04:25] COMMAND POST "/wd/hub/session/c5d34971-6a95-47cb-9c92-e7e807061c14/element/CC000000-0000-0000-3A0C-000000000000/clear"
[07:04:25] DATA {}
[07:04:25] COMMAND POST "/wd/hub/session/c5d34971-6a95-47cb-9c92-e7e807061c14/element/CC000000-0000-0000-3A0C-000000000000/value"
[07:04:25] DATA {"value":["B","e","n"," ","j","e"," ","e","r","?"],"text":"Ben je er?"}
[HTTP]
[HTTP] --> POST /wd/hub/session/5550bbcd-fad3-40b8-88cd-10350022c6b3/element
[HTTP] {"using":"accessibility id","value":"test-Stel hier je vraag."}
[debug] [MJSONWP] Calling AppiumDriver.findElement() with args: ["accessibility id","test-Stel hier je vraag.","5550bbcd-fad3-40b8-88cd-10350022c6b3"]
[debug] [XCUITest] Executing command 'findElement'
[debug] [BaseDriver] Valid locator strategies for this request: xpath, id, name, class name, -ios predicate string, -ios class chain, accessibility id
[debug] [BaseDriver] Waiting up to 0 ms for condition
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8100/session/15326722-C363-4CA0-B4D8-899E9077F830/element] with body: {"using":"accessibility id","value":"test-Stel hier je vraag."}
[debug] [JSONWP Proxy] Got response with status 200: {"value":{"ELEMENT":"CB000000-0000-0000-9F0B-000000000000"},"sessionId":"15326722-C363-4CA0-B4D8-899E9077F830","status":0}
[debug] [MJSONWP] Responding to client with driver.findElement() result: {"ELEMENT":"CB000000-0000-0000-9F0B-000000000000"}
[HTTP] <-- POST /wd/hub/session/5550bbcd-fad3-40b8-88cd-10350022c6b3/element 200 204 ms - 122
[HTTP]
[HTTP] --> POST /wd/hub/session/5550bbcd-fad3-40b8-88cd-10350022c6b3/element/CB000000-0000-0000-9F0B-000000000000/clear
[HTTP] {}
[debug] [MJSONWP] Calling AppiumDriver.clear() with args: ["CB000000-0000-0000-9F0B-000000000000","5550bbcd-fad3-40b8-88cd-10350022c6b3"]
[debug] [XCUITest] Executing command 'clear'
[debug] [JSONWP Proxy] Proxying [POST /element/CB000000-0000-0000-9F0B-000000000000/clear] to [POST http://localhost:8100/session/15326722-C363-4CA0-B4D8-899E9077F830/element/CB000000-0000-0000-9F0B-000000000000/clear] with no body
[debug] [JSONWP Proxy] Got response with status 200: "{\n \"status\" : 0,\n \"id\" : \"CB000000-0000-0000-9F0B-000000000000\",\n \"value\" : \"\",\n \"sessionId\" : \"15326722-C363-4CA0-B4D8-899E9077F830\"\n}"
[debug] [MJSONWP] Responding to client with driver.clear() result: null
[HTTP] <-- POST /wd/hub/session/5550bbcd-fad3-40b8-88cd-10350022c6b3/element/CB000000-0000-0000-9F0B-000000000000/clear 200 125 ms - 76
[HTTP]
[HTTP] --> POST /wd/hub/session/5550bbcd-fad3-40b8-88cd-10350022c6b3/element/CB000000-0000-0000-9F0B-000000000000/value
[HTTP] {"value":["B","e","n"," ","j","e"," ","e","r","?"],"text":"Ben je er?"}
[debug] [MJSONWP] Calling AppiumDriver.setValue() with args: [["B","e","n"," ","j","e"," ","e","r","?"],"CB000000-0000-0000-9F0B-000000000000","5550bbcd-fad3-40b8-88cd-10350022c6b3"]
[debug] [XCUITest] Executing command 'setValue'
[debug] [JSONWP Proxy] Proxying [POST /element/CB000000-0000-0000-9F0B-000000000000/value] to [POST http://localhost:8100/session/15326722-C363-4CA0-B4D8-899E9077F830/element/CB000000-0000-0000-9F0B-000000000000/value] with body: {"value":["B","e","n"," ","j","e"," ","e","r","?"]}
[HTTP] --> GET /wd/hub/status
[HTTP] {}
[debug] [MJSONWP] Calling AppiumDriver.getStatus() with args: []
[debug] [MJSONWP] Responding to client with driver.getStatus() result: {"build":{"version":"1.8.1","revision":"b546436113084d6de584c57b259b947dd467a900"}}
[HTTP] <-- GET /wd/hub/status 200 19 ms - 121
[HTTP]
[debug] [JSONWP Proxy] Got response with status 200: {"value":"Error Domain=com.facebook.WebDriverAgent Code=1 \"Keyboard is not present\" UserInfo={NSLocalizedDescription=Keyboard is not present}","sessionId":"15326722-C363-4CA0-B4D8-899E9077F830","status":13}
[debug] [JSONWP Proxy] Proxying [GET /element/CB000000-0000-0000-9F0B-000000000000/attribute/type] to [GET http://localhost:8100/session/15326722-C363-4CA0-B4D8-899E9077F830/element/CB000000-0000-0000-9F0B-000000000000/attribute/type] with no body
[debug] [JSONWP Proxy] Got response with status 200: "{\n \"value\" : \"XCUIElementTypeTextField\",\n \"sessionId\" : \"15326722-C363-4CA0-B4D8-899E9077F830\",\n \"status\" : 0\n}"
[XCUITest] Cannot type in the text field because of Error: An unknown server-side error occurred while processing the command..
[XCUITest] Trying to apply a workaround...
[debug] [BaseDriver] Set implicit wait to 0ms
[debug] [BaseDriver] Waiting up to 0 ms for condition
[debug] [JSONWP Proxy] Proxying [POST /element] to [POST http://localhost:8100/session/15326722-C363-4CA0-B4D8-899E9077F830/element] with body: {"using":"class name","value":"XCUIElementTypeKeyboard"}
[debug] [JSONWP Proxy] Got response with status 200: {"value":{"ELEMENT":"19010000-0000-0000-9F0B-000000000000"},"sessionId":"15326722-C363-4CA0-B4D8-899E9077F830","status":0}
[debug] [XCUITest] Keyboard found. Continuing with text input.
[debug] [BaseDriver] Set implicit wait to 0ms
[debug] [JSONWP Proxy] Proxying [POST /element/CB000000-0000-0000-9F0B-000000000000/value] to [POST http://localhost:8100/session/15326722-C363-4CA0-B4D8-899E9077F830/element/CB000000-0000-0000-9F0B-000000000000/value] with body: {"value":["B","e","n"," ","j","e"," ","e","r","?"]}
[debug] [JSONWP Proxy] Got response with status 200: {"value":"Error Domain=com.facebook.WebDriverAgent Code=1 \"Keyboard is not present\" UserInfo={NSLocalizedDescription=Keyboard is not present}","sessionId":"15326722-C363-4CA0-B4D8-899E9077F830","status":13}
[MJSONWP] Encountered internal error running command: Error: An unknown server-side error occurred while processing the command.
[MJSONWP] at JWProxy.command$ (/Users/wimselles/.nvm/versions/node/v8.9.1/lib/node_modules/appium/node_modules/appium-base-driver/lib/jsonwp-proxy/proxy.js:176:15)
[MJSONWP] at tryCatch (/Users/wimselles/.nvm/versions/node/v8.9.1/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
[MJSONWP] at GeneratorFunctionPrototype.invoke [as _invoke] (/Users/wimselles/.nvm/versions/node/v8.9.1/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
[MJSONWP] at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Users/wimselles/.nvm/versions/node/v8.9.1/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
[MJSONWP] at GeneratorFunctionPrototype.invoke (/Users/wimselles/.nvm/versions/node/v8.9.1/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
[MJSONWP] at <anonymous>
[HTTP] <-- POST /wd/hub/session/5550bbcd-fad3-40b8-88cd-10350022c6b3/element/CB000000-0000-0000-9F0B-000000000000/value 500 9791 ms - 238
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment