Skip to content

Commit

Permalink
Ensure all capabilities are either within desiredCapabilities or requ…
Browse files Browse the repository at this point in the history
…iredCapabilities
  • Loading branch information
davehunt committed May 18, 2016
1 parent 98edbe8 commit a63d5e7
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions py/selenium/webdriver/remote/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,15 @@ def start_session(self, desired_capabilities, browser_profile=None):
- javascript_enabled - Whether the new session should support JavaScript.
- browser_profile - A selenium.webdriver.firefox.firefox_profile.FirefoxProfile object. Only used if Firefox is requested.
"""
capabilities = {}
for k, v in desired_capabilities.items():
if k not in ('desiredCapabilities', 'requiredCapabilities'):
capabilities.setdefault('desiredCapabilities', {})[k] = v
else:
capabilities[k] = v
if browser_profile:
desired_capabilities['firefox_profile'] = browser_profile.encoded
response = self.execute(Command.NEW_SESSION, {
'desiredCapabilities': desired_capabilities,
})
capabilities['requiredCapabilities']['firefox_profile'] = browser_profile.encoded
response = self.execute(Command.NEW_SESSION, capabilities)
self.session_id = response['sessionId']
self.capabilities = response['value']

Expand Down

0 comments on commit a63d5e7

Please sign in to comment.