Skip to content

Can no longer specify browserName with Grid desiredcaps #6412

@jessehudl

Description

@jessehudl

The problem

Appium v1.5 no longer accepts a non-empty browserName desired capability, which breaks compatibility with Grid and contradicts the Appium documentation.

Environment

  • Appium version (or git revision) that exhibits the issue: 1.5+
  • Last Appium version that did not exhibit the issue (if applicable): 1.4
  • Desktop OS/version used to run Appium: OSX 10.11.4
  • Node.js version (unless using Appium.app|exe): 4.2.1
  • Mobile platform/version under test: Any
  • Real device or emulator/simulator: Both
  • Appium CLI or Appium.app|exe: CLI

Details

The Selenium Grid server matches capabilities to nodes using browserName, version, and platform. The session is then passed to the matching node and Appium looks for deviceName, platformName, and app. Appium's Grid docs also specify this, and recommend using a node configuration file with the following capabilities:

          "browserName": "<e.g._iPhone5_or_iPad4>",
          "version":"<version_of_iOS_e.g._7.1>",
          "maxInstances": 1,
          "platform":"<platform_e.g._MAC_or_ANDROID>"

browserName being used as a way to specify the device or simulator for the Grid to match the node on (e.g. iPhone 5). It appears in Appium 1.5, this is no longer working as reported by this bug. Now this fails with:

WebDriverException: Message: A new session could not be created. Details: The desiredCapabilities object was not valid for the following reason(s): browserName iPhone 6S is not included in the list.

The workaround from #6177 is to use an empty browserName capability, but in doing so the Grid is no longer able to match nodes properly since it's only matching based on version, and platform, meaning it will open anything that matches (iPad, iPhone, Nexus, etc.) The workarounds would be either giving each device a unique version for the Grid to match (which then doesn't match deviceVersion and confusing), or use a workaround capability like applicationName. Neither are backwards compatible with previous configurations or the documentation and make working with the Grid much more difficult.

Link to Appium logs

https://gist.github.com/jessehudl/ed5a879f478a74f8071d327ddc067a87

Code To Reproduce Issue [ Good To Have ]

Register a v1.5+ Appium node with a Selenium Grid hub using a node config like the one from the Appium documentation - http://appium.io/slate/en/master/?ruby#grid-node-configuration-example-json-file

Try to start a session (python example):

In [43]: driver = webdriver.Remote('http://grid01:4445/wd/hub', {'platform':'MAC', 'deviceName':'iPhone 6s', 'browserName':'iPhone 6S', 'platformName':'iOS'})                       ---------------------------------------------------------------------------
WebDriverException                        Traceback (most recent call last)
<ipython-input-43-2142773a6c76> in <module>()
----> 1 driver = webdriver.Remote('http://grid01:4445/wd/hub', {'platform':'MAC', 'deviceName':'iPhone 6s', 'browserName':'iPhone 6S', 'platformName':'iOS'})

/usr/local/lib/python3.5/site-packages/appium/webdriver/webdriver.py in __init__(self, command_executor, desired_capabilities, browser_profile, proxy, keep_alive)
     34                  desired_capabilities=None, browser_profile=None, proxy=None, keep_alive=False):
     35
---> 36         super(WebDriver, self).__init__(command_executor, desired_capabilities, browser_profile, proxy, keep_alive)
     37
     38         if self.command_executor is not None:

/usr/local/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py in __init__(self, command_executor, desired_capabilities, browser_profile, proxy, keep_alive, file_detector)
     89         self.error_handler = ErrorHandler()
     90         self.start_client()
---> 91         self.start_session(desired_capabilities, browser_profile)
     92         self._switch_to = SwitchTo(self)
     93         self._mobile = Mobile(self)

/usr/local/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py in start_session(self, desired_capabilities, browser_profile)
    171             desired_capabilities['firefox_profile'] = browser_profile.encoded
    172         response = self.execute(Command.NEW_SESSION, {
--> 173             'desiredCapabilities': desired_capabilities,
    174         })
    175         self.session_id = response['sessionId']

/usr/local/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py in execute(self, driver_command, params)
    231         response = self.command_executor.execute(driver_command, params)
    232         if response:
--> 233             self.error_handler.check_response(response)
    234             response['value'] = self._unwrap_value(
    235                 response.get('value', None))

/usr/local/lib/python3.5/site-packages/selenium/webdriver/remote/errorhandler.py in check_response(self, response)
    192         elif exception_class == UnexpectedAlertPresentException and 'alert' in value:
    193             raise exception_class(message, screen, stacktrace, value['alert'].get('text'))
--> 194         raise exception_class(message, screen, stacktrace)
    195
    196     def _value_or_default(self, obj, key, default):

WebDriverException: Message: A new session could not be created. Details: The desiredCapabilities object was not valid for the following reason(s): browserName iPhone 6S is not included in the list.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions