[XCUITest] Error: Unable to start WebDriverAgent session: (this.opts.platformVersion || "").indexOf is not a function

With the following caps file: {“platformName”=>“iOS”, “platformVersion”=>10.3, “deviceName”=>“103Air2”, “app”=>"~/Mobile.app", “automationName”=>“xcuitest”, “noReset”=>true, “sendKeyStrategy”=>“setValue”, “newCommandTimeout”=>300}

[XCUITest] Error: Unable to start WebDriverAgent session: (this.opts.platformVersion || "").indexOf is not a function
at XCUITestDriver.quitAndUninstall$ (../../lib/driver.js:374:15)
at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
at process._tickCallback (internal/process/next_tick.js:103:7)

Error: Unable to start WebDriverAgent session: (this.opts.platformVersion || “”).indexOf is not a function
at XCUITestDriver.quitAndUninstall$ (…/…/lib/driver.js:374:15)
at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
at process._tickCallback (internal/process/next_tick.js:103:7)
[MJSONWP] Encountered internal error running command: Error: Unable to start WebDriverAgent session: (this.opts.platformVersion || “”).indexOf is not a function
at XCUITestDriver.quitAndUninstall$ (…/…/lib/driver.js:374:15)
at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
at process._tickCallback (internal/process/next_tick.js:103:7)
An unknown server-side error occurred while processing the command. Original error: Unable to start WebDriverAgent session: (this.opts.platformVersion || “”).indexOf is not a function (Selenium::WebDriver::Error::UnknownError)

I recently ran into this problem. It was caused by setting the platformVersion capability to a float instead of a string (in this example, 10.3 instead of "10.3"). I submitted a pull request this morning to allow for either type, but for anyone running into this problem in the meantime, wrapping your platformVersion capability in quotes should fix it.