Skip to content

Commit

Permalink
[python] Remove Edge legacy options. (SeleniumHQ#9908)
Browse files Browse the repository at this point in the history
Co-authored-by: David Burns <david.burns@theautomatedtester.co.uk>
  • Loading branch information
2 people authored and elgatov committed Jun 27, 2022
1 parent b85a830 commit b4233e9
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 30 deletions.
2 changes: 1 addition & 1 deletion py/BUILD.bazel
Expand Up @@ -308,7 +308,7 @@ py_test_suite(
]),
args = [
"--instafail",
"--driver=Edge",
"--driver=edge",
],
tags = [
"no-sandbox",
Expand Down
1 change: 0 additions & 1 deletion py/conftest.py
Expand Up @@ -146,7 +146,6 @@ def get_options(driver_class, config):

if driver_class == 'ChromiumEdge':
options = getattr(webdriver, 'EdgeOptions')()
options.use_chromium = True

if browser_path or browser_args:
if not options:
Expand Down
21 changes: 3 additions & 18 deletions py/selenium/webdriver/edge/options.py
Expand Up @@ -24,17 +24,8 @@ class Options(ChromiumOptions):

def __init__(self):
super(Options, self).__init__()
self._use_chromium = True
self._use_webview = False

@property
def use_chromium(self) -> bool:
return self._use_chromium

@use_chromium.setter
def use_chromium(self, value: bool):
self._use_chromium = bool(value)

@property
def use_webview(self) -> bool:
return self._use_webview
Expand All @@ -48,16 +39,10 @@ def to_capabilities(self) -> dict:
Creates a capabilities with all the options that have been set and
:Returns: A dictionary with everything
"""
caps = self._caps

if self._use_chromium:
caps = super(Options, self).to_capabilities()
if self._use_webview:
caps['browserName'] = 'webview2'
else:
caps['platform'] = 'windows'
caps = super(Options, self).to_capabilities()
if self._use_webview:
caps['browserName'] = 'webview2'

caps['ms:edgeChromium'] = self._use_chromium
return caps

@property
Expand Down
3 changes: 1 addition & 2 deletions py/selenium/webdriver/edge/webdriver.py
Expand Up @@ -28,8 +28,7 @@
class WebDriver(ChromiumDriver):
"""
Controls the Microsoft Edge driver and allows you to drive the browser.
You will need to download either the MicrosoftWebDriver (Legacy)
or MSEdgeDriver (Chromium) executable from
You will need to download the MSEdgeDriver (Chromium) executable from
https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/
"""

Expand Down
8 changes: 0 additions & 8 deletions py/test/unit/selenium/webdriver/edge/edge_options_tests.py
Expand Up @@ -59,16 +59,8 @@ def test_is_a_baseoptions(options):
assert isinstance(options, BaseOptions)


def test_use_chromium():
options = Options()
options.use_chromium = True
caps = options.to_capabilities()
assert caps['ms:edgeChromium'] is True


def test_use_webview():
options = Options()
options.use_chromium = True
options.use_webview = True
caps = options.to_capabilities()
assert caps['browserName'] == "webview2"

0 comments on commit b4233e9

Please sign in to comment.