Skip to content

Commit

Permalink
[py] Correct deprecations in IE bindings. Fixes #9818
Browse files Browse the repository at this point in the history
  • Loading branch information
AutomatedTester committed Oct 8, 2021
1 parent 136067e commit 6c5c572
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 19 deletions.
8 changes: 4 additions & 4 deletions py/selenium/webdriver/common/desired_capabilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class DesiredCapabilities(object):

INTERNETEXPLORER = {
"browserName": "internet explorer",
"platformName": "WINDOWS",
"platformName": "windows",
}

EDGE = {
Expand All @@ -72,7 +72,7 @@ class DesiredCapabilities(object):

SAFARI = {
"browserName": "safari",
"platformName": "MAC",
"platformName": "mac",
}

HTMLUNIT = {
Expand All @@ -91,13 +91,13 @@ class DesiredCapabilities(object):
IPHONE = {
"browserName": "iPhone",
"version": "",
"platform": "MAC",
"platform": "mac",
}

IPAD = {
"browserName": "iPad",
"version": "",
"platform": "MAC",
"platform": "mac",
}

WEBKITGTK = {
Expand Down
21 changes: 6 additions & 15 deletions py/selenium/webdriver/ie/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def __init__(self, executable_path='IEDriverServer.exe', capabilities=None,
DeprecationWarning, stacklevel=2)
if capabilities:
warnings.warn('capabilities has been deprecated, please pass in an Options object.'
'This field will be ignored if an Options object is also used.',
'This field will be ignored.',
DeprecationWarning, stacklevel=2)
if port != DEFAULT_PORT:
warnings.warn('port has been deprecated, please pass in a Service object',
Expand All @@ -79,32 +79,23 @@ def __init__(self, executable_path='IEDriverServer.exe', capabilities=None,
warnings.warn('service_log_path has been deprecated, please pass in a Service object',
DeprecationWarning, stacklevel=2)
if desired_capabilities:
warnings.warn('desired_capabilities has been deprecated, please pass in an Options object',
warnings.warn('desired_capabilities has been deprecated, please pass in an Options object.'
'This field will be ignored',
DeprecationWarning, stacklevel=2)
if keep_alive != DEFAULT_KEEP_ALIVE:
warnings.warn('keep_alive has been deprecated, please pass in a Service object',
DeprecationWarning, stacklevel=2)
else:
keep_alive = False
keep_alive = True

self.host = host
self.port = port
if self.port == 0:
self.port = utils.free_port()

# If both capabilities and desired capabilities are set, ignore desired capabilities.
if not capabilities and desired_capabilities:
capabilities = desired_capabilities

if not options:
if not capabilities:
capabilities = self.create_options().to_capabilities()
else:
if not capabilities:
capabilities = options.to_capabilities()
else:
# desired_capabilities stays as passed in
capabilities.update(options.to_capabilities())
options = self.create_options()

if service:
self.iedriver = service
else:
Expand Down

0 comments on commit 6c5c572

Please sign in to comment.