Skip to content

Commit

Permalink
Adding customizable browser_name capability to microsoftedge (Seleniu…
Browse files Browse the repository at this point in the history
…mHQ#7650)

* Adding customizable browser_name capability to microsoftedge to allow driving webviews.
  • Loading branch information
stanleyhon authored and AutomatedTester committed Oct 15, 2019
1 parent f6d02b3 commit e940e94
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
14 changes: 13 additions & 1 deletion py/selenium/webdriver/edge/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,19 @@ class Options(ChromiumOptions):
def __init__(self, is_legacy=True):
super(Options, self).__init__()
self._is_legacy = is_legacy
self._custom_browser_name = None

if is_legacy:
self._page_load_strategy = "normal"

@property
def custom_browser_name(self):
return self._custom_browser_name

@custom_browser_name.setter
def custom_browser_name(self, value):
self._custom_browser_name = value

@property
def page_load_strategy(self):
if not self._is_legacy:
Expand All @@ -50,7 +59,10 @@ def to_capabilities(self):
:Returns: A dictionary with everything
"""
if not self._is_legacy:
return super(Options, self).to_capabilities()
return_caps = super(Options, self).to_capabilities()
if self._custom_browser_name:
return_caps['browserName'] = self._custom_browser_name
return return_caps

caps = self._caps
caps['pageLoadStrategy'] = self._page_load_strategy
Expand Down
6 changes: 6 additions & 0 deletions py/test/unit/selenium/webdriver/edge/edge_options_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,9 @@ def test_starts_with_default_capabilities(options):
def test_is_a_baseoptions(options):
from selenium.webdriver.common.options import BaseOptions
assert isinstance(options, BaseOptions)

def test_custom_browser_name():
options = Options(is_legacy=False)
options.custom_browser_name = "testbrowsername"
caps = options.to_capabilities()
assert caps['browserName'] == "testbrowsername"

0 comments on commit e940e94

Please sign in to comment.