Unable to register Appium node in grid
🐛 Bug Report
Grid cannot register Appium node using capabilities (not desiredCapabilities).
Grid Log:
WARN:osjs.HttpChannel:qtp1908143486-19: /wd/hub/session java.io.IOException:
org.openqa.grid.common.exception.GridException: Cannot extract a capabilities from the request:
{
"capabilities":{
"alwaysMatch":{
"platformName":"Android","platformVersion":"9.0.0","deviceName":"Pixel 2","browserName":"chrome"},
"firstMatch":[{}]
},
"desiredCapabilities":{
"platformName":"Android","platformVersion":"9.0.0","deviceName":"Pixel 2","browserName":"chrome"
}
}
and more
java.lang.IllegalArgumentException: Illegal key values seen in w3c capabilities:
[chromeDriverPort, chromeOptions, deviceName, newCommandTimeout, platformVersion, systemPort, udid]
To Reproduce
- Run grid
java -Dselenium.LOGGER.level=ALL -jar ./selenium-server-standalone-3.141.59.jar -role hub - Create session with body:
{
capabilities: {
alwaysMatch: {
platformName: 'Android',
platformVersion: '9.0.0',
deviceName: 'Pixel 2',
browserName: 'chrome'
},
firstMatch: [ {} ]
},
desiredCapabilities: {
platformName: 'Android',
platformVersion: '9.0.0',
deviceName: 'Pixel 2',
browserName: 'chrome'
}
}
Expected behavior
should be possible to create session having capabilities with Appium specific properties in body, like: platformName: 'Android, iOS', platformVersion, deviceName, udid, chromeDriverPort, systemPort, chromeOptions, newCommandTimeout, and others.
Environment
OS: OSX Selenium Grid version: 3.141.59
Additional Information
Issue was found using webdriverio 5.x.x https://github.com/webdriverio/webdriverio/issues/3252
more discussion here https://github.com/webdriverio/webdriverio/pull/3259
sample wdio config to easily reproduce the issue:
hostname: '127.0.0.1',
port: 4444,
maxInstances: 1,
capabilities: [{
platformName: 'Android',
platformVersion: '9.0.0',
deviceName: 'Pixel 2',
browserName: 'chrome',
}],
specs: [ './test/specs/**/*.js' ],
framework: 'mocha'
}
Working scenarios
- body with browser specific properties in capabilities:
{
capabilities: {
alwaysMatch: {
browserName: 'chrome'
},
firstMatch: [ {} ]
},
desiredCapabilities: {
browserName: 'chrome'
}
}
- body with Appium specific properties in desiredCapabilities
{
desiredCapabilities: {
platformName: 'Android',
platformVersion: '9.0.0',
deviceName: 'Pixel 2',
browserName: 'chrome'
}
}
if (!illegalKeys.isEmpty()) {
throw new IllegalArgumentException(
"Illegal key values seen in w3c capabilities: " + illegalKeys);
}
I've tried to rebuild server with disabled throwing of exception and it works well.
Is there a way to extend ACCEPTED_W3C_PATTERNS with Appium properties or disable exception throwing in case there is some illegal key (maybe with some parameter)?
Closing issue, it is necessary to pass capabilities with appium: prefix, like this: capabilities: [{ "appium:platformName": 'Android', "appium:platformVersion": '9.0.0', "appium:deviceName": 'Pixel 2', "appium:browserName": 'chrome', }]