appium: Appium CLI doesn't pass capabilities args

Appium v.1.7.2 installed via npm over Win10 and running with node.js 8.9.1, connected to Xiaomi Mi5 with MIUI 9.2.1 (Android 7)

When running from batch script with help of appium-java-client (5.0.0-BETA8) somehow on third AppiumDriver.createSession-call it mixes up the order of parameters. First two calls (for Unlock.app and Appium Settings) passes capabilities correctly. But my application itself fails with some you forgot to define platformName capability error. I found out, that caps argument is null this call, but unfortunatelly i’m not node-developer and can’t find, why createSession callee mixes up the parameters

Short log for these three calls:

Calling AppiumDriver.createSession() with args:
[
	{
		"appPackage":"app.domain",
		"app":"Path\To\file.apk",
		"appActivity":"Activity.Domain.And.Name",
		"newCommandTimeout":120,
		"automationName":"UiAutomator2",
		"udid":"unique",
		"platformName":"Android",
		"deviceName":"Mi5"
	},
	{},
	[
		{
			"desiredCapabilities":{
				"appPackage":"app.domain",
				"app":"Path\To\file.apk",
				"appActivity":"Activity.Domain.And.Name",
				"newCommandTimeout":120,
				"automationName":"UiAutomator2",
				"udid":"unique",
				"platformName":"Android",
				"deviceName":"Mi5"
			}
		},
		{
			"requiredCapabilities":{}
		}
	]
]
//<...>
Calling AppiumDriver.createSession() with args:
[
	{
		"appPackage":"app.domain",
		"app":"Path\To\file.apk",
		"appActivity":"Activity.Domain.And.Name",
		"newCommandTimeout":120,
		"automationName":"UiAutomator2",
		"udid":"unique",
		"platformName":"Android",
		"deviceName":"Mi5"
	},
	{},
	null
]
//<...>
Calling AppiumDriver.createSession() with args:
[
	null,
	null,
	[
		{
			"desiredCapabilities":{
				"appPackage":"app.domain",
				"app":"Path\To\file.apk",
				"appActivity":"Activity.Domain.And.Name",
				"newCommandTimeout":120,
				"automationName":"UiAutomator2",
				"udid":"unique",
				"platformName":"Android",
				"deviceName":"Mi5"
			}
		},
		{
			"requiredCapabilities":{}
		}
	]
]

Full log for last call with stacktrace:

[debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [null,null,[{"desiredCapabilities":{"appPackage":"app.domain","app":"Path\To\file.apk","appActivity":"Activity.Domain.And.Name","newCommandTimeout":120,"automationName":"UiAutomator2","udid":"unique","platformName":"Android","deviceName":"MyDevice"}},{"requiredCapabilities":{}}]]
[debug] [BaseDriver] Event 'newSessionRequested' logged at 1519045424668 (16:03:44 GMT+0300 (RTZ 2 (зима)))
[MJSONWP] Encountered internal error running command: Error: You must include a platformName capability
    at AppiumDriver.getDriverForCaps (../../lib/appium.js:64:13)
    at AppiumDriver.createSession$ (../../lib/appium.js:180:28)
    at tryCatch (Path\To\Appium\appium\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (Path\To\Appium\appium\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (Path\To\Appium\appium\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
    at invoke (Path\To\Appium\appium\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)
    at enqueueResult (Path\To\Appium\appium\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:185:17)
    at new Promise (<anonymous>)
    at new F (Path\To\Appium\appium\node_modules\appium\node_modules\core-js\library\modules\$.export.js:30:36)
    at AsyncIterator.enqueue (Path\To\Appium\appium\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:184:12)
    at AsyncIterator.prototype.(anonymous function) [as next] (Path\To\Appium\appium\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
    at Object.runtime.async (Path\To\Appium\appium\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:209:12)
    at AppiumDriver.createSession (../../lib/appium.js:205:30)
    at AppiumDriver.executeCommand$ (../../../lib/basedriver/driver.js:246:27)
    at tryCatch (Path\To\Appium\appium\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (Path\To\Appium\appium\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (Path\To\Appium\appium\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
    at invoke (Path\To\Appium\appium\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)
    at enqueueResult (Path\To\Appium\appium\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:185:17)
    at new Promise (<anonymous>)
    at new F (Path\To\Appium\appium\node_modules\appium\node_modules\core-js\library\modules\$.export.js:30:36)
    at AsyncIterator.enqueue (Path\To\Appium\appium\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:184:12)
    at AsyncIterator.prototype.(anonymous function) [as next] (Path\To\Appium\appium\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
    at Object.runtime.async (Path\To\Appium\appium\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:209:12)
    at AppiumDriver.executeCommand (../../../lib/basedriver/driver.js:261:16)
    at AppiumDriver.executeCommand$ (../../lib/appium.js:24:19)
    at tryCatch (Path\To\Appium\appium\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (Path\To\Appium\appium\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (Path\To\Appium\appium\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
    at invoke (Path\To\Appium\appium\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)
    at enqueueResult (Path\To\Appium\appium\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:185:17)
    at new Promise (<anonymous>)
    at new F (Path\To\Appium\appium\node_modules\appium\node_modules\core-js\library\modules\$.export.js:30:36)
    at AsyncIterator.enqueue (Path\To\Appium\appium\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:184:12)
    at AsyncIterator.prototype.(anonymous function) [as next] (Path\To\Appium\appium\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
    at Object.runtime.async (Path\To\Appium\appium\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:209:12)
    at AppiumDriver.executeCommand (../../lib/appium.js:306:21)
    at asyncHandler$ (../../../lib/mjsonwp/mjsonwp.js:269:48)
    at tryCatch (Path\To\Appium\appium\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (Path\To\Appium\appium\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (Path\To\Appium\appium\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
    at invoke (Path\To\Appium\appium\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)
    at enqueueResult (Path\To\Appium\appium\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:185:17)
    at new Promise (<anonymous>)
    at new F (Path\To\Appium\appium\node_modules\appium\node_modules\core-js\library\modules\$.export.js:30:36)
    at AsyncIterator.enqueue (Path\To\Appium\appium\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:184:12)
    at AsyncIterator.prototype.(anonymous function) [as next] (Path\To\Appium\appium\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
    at Object.runtime.async (Path\To\Appium\appium\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:209:12)
    at asyncHandler (../../../lib/mjsonwp/mjsonwp.js:303:20)
    at ../../../lib/mjsonwp/mjsonwp.js:332:15
    at Layer.handle [as handle_request] (Path\To\Appium\appium\node_modules\appium\node_modules\express\lib\router\layer.js:95:5)
    at next (Path\To\Appium\appium\node_modules\appium\node_modules\express\lib\router\route.js:137:13)
    at Route.dispatch (Path\To\Appium\appium\node_modules\appium\node_modules\express\lib\router\route.js:112:3)
    at Layer.handle [as handle_request] (Path\To\Appium\appium\node_modules\appium\node_modules\express\lib\router\layer.js:95:5)
    at Path\To\Appium\appium\node_modules\appium\node_modules\express\lib\router\index.js:281:22
    at Function.process_params (Path\To\Appium\appium\node_modules\appium\node_modules\express\lib\router\index.js:335:12)
    at next (Path\To\Appium\appium\node_modules\appium\node_modules\express\lib\router\index.js:275:10)
    at logger (Path\To\Appium\appium\node_modules\appium\node_modules\morgan\index.js:144:5)
    at Layer.handle [as handle_request] (Path\To\Appium\appium\node_modules\appium\node_modules\express\lib\router\layer.js:95:5)
    at trim_prefix (Path\To\Appium\appium\node_modules\appium\node_modules\express\lib\router\index.js:317:13)
    at Path\To\Appium\appium\node_modules\appium\node_modules\express\lib\router\index.js:284:7
    at Function.process_params (Path\To\Appium\appium\node_modules\appium\node_modules\express\lib\router\index.js:335:12)
    at next (Path\To\Appium\appium\node_modules\appium\node_modules\express\lib\router\index.js:275:10)
    at Path\To\Appium\appium\node_modules\appium\node_modules\body-parser\lib\read.js:125:5
    at invokeCallback (Path\To\Appium\appium\node_modules\appium\node_modules\raw-body\index.js:224:16)
    at done (Path\To\Appium\appium\node_modules\appium\node_modules\raw-body\index.js:213:7)
    at IncomingMessage.onEnd (Path\To\Appium\appium\node_modules\appium\node_modules\raw-body\index.js:273:7)
    at emitNone (events.js:106:13)
    at IncomingMessage.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1056:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
[HTTP] <-- POST /wd/hub/session 500 199 ms - 179

Any help is appreciated. Thank you for your attention

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 19

Most upvoted comments

Are you sure you send correct capabilities data in the client script?