Skip to content

Commit 5d42571

Browse files
committed
Merge pull request #258 from ombre42/master
fixes #217 - copy desired capabilities before modifying
2 parents 064ef4e + 4586aee commit 5d42571

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/Selenium2Library/keywords/_browsermanagement.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ def _create_remote_web_driver(self , capabilities_type , remote_url , desired_ca
550550
'''parses the string based desired_capabilities if neccessary and
551551
creates the associated remote web driver'''
552552

553-
desired_capabilities_object = capabilities_type
553+
desired_capabilities_object = capabilities_type.copy()
554554

555555
if type(desired_capabilities) in (str, unicode):
556556
desired_capabilities = self._parse_capabilities_string(desired_capabilities)

test/unit/keywords/test_browsermanagement.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ def test_create_remote_browser_with_string_desired_prefs(self):
7070
self.verify_browser(webdriver.Remote, "chrome", remote="http://127.0.0.1/wd/hub",
7171
desired_capabilities=expected_caps)
7272

73+
def test_capabilities_attribute_not_modified(self):
74+
expected_caps = {"some_cap":"42"}
75+
self.verify_browser(webdriver.Remote, "chrome", remote="http://127.0.0.1/wd/hub",
76+
desired_capabilities=expected_caps)
77+
self.assertFalse("some_cap" in webdriver.DesiredCapabilities.CHROME)
78+
7379
def test_set_selenium_timeout_only_affects_open_browsers(self):
7480
bm = _BrowserManagementKeywords()
7581
first_browser, second_browser = mock(), mock()

0 commit comments

Comments
 (0)