selenium icon indicating copy to clipboard operation
selenium copied to clipboard

Unable to register Appium node in grid

Open xlenz opened this issue 7 years ago • 2 comments

🐛 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

  1. Run grid java -Dselenium.LOGGER.level=ALL -jar ./selenium-server-standalone-3.141.59.jar -role hub
  2. 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'
  }
}

xlenz avatar Jan 07 '19 20:01 xlenz

          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)?

xlenz avatar Jan 07 '19 23:01 xlenz

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', }]

xlenz avatar Jan 08 '19 16:01 xlenz