You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Using desired_capabilities affects future sessions #217
When desired_capabilities is passed to Open Browser, the default DesiredCapabilities object for the requested browser (which is a class attribute) is changed for the remainder of the test run. Unfortunately, the Selenium project's examples for Python demonstrate doing it that way.
I will submit a pull request to address this issue.
If instead we took a copy of the default desired capabilities object and manipulated that, this would not be an issue. A deep copy would safeguard against default capabilities with nested dicts.
In the following set of test cases, Second will use the proxy setup in First, even if they reside in different suites. You can see this in the output of Open Browser in Second if you run with log level DEBUG:
20130625 16:49:20.017 : DEBUG : POST http://127.0.0.1:4444/wd/hub/session {"sessionId": null, "desiredCapabilities": {"platform": "ANY", "browserName": "chrome", "version": "", "proxy": {"proxyType": "MANUAL", "httpProxy": "localhost:8888"}, "javascriptEnabled": true}}
First
${chrome dc}= Evaluate selenium.webdriver.DesiredCapabilities.CHROME selenium
Dictionary Should Not Contain Key ${chrome dc} proxy
${desired capabilities}= Evaluate {'proxy': {'proxyType': 'MANUAL', 'httpProxy': 'localhost:8888'}}
Open Browser http://www.google.com/ gc remote_url=http://localhost:4444/wd/hub desired_capabilities=${desired capabilities}
[Teardown] Close Browser
Second
${chrome dc}= Evaluate selenium.webdriver.DesiredCapabilities.CHROME selenium
Run Keyword And Continue On Failure Dictionary Should Not Contain Key ${chrome dc} proxy
Open Browser http://www.msn.com/ gc remote_url=http://localhost:4444/wd/hub
[Teardown] Close Browser
This may be fixed upstream. Selenium team is considering returning a copy of the desired capabilities dict in this issue. Since this issue was discovered in code analysis and not reported by users and may be fixed upstream, moving to 1.6.
Looks like Selenium team thinks users should work with a copy of the desired capabilities. Since a Selenium2Library user does not really have a choice, we should always work with a copy. If a capability is required in every browser opened in the same session, then is must be specified in every call to Open Browser.
Activity
ombre42 commentedon Dec 28, 2013
This may be fixed upstream. Selenium team is considering returning a copy of the desired capabilities dict in this issue. Since this issue was discovered in code analysis and not reported by users and may be fixed upstream, moving to 1.6.
ombre42 commentedon Dec 29, 2013
Looks like Selenium team thinks users should work with a copy of the desired capabilities. Since a Selenium2Library user does not really have a choice, we should always work with a copy. If a capability is required in every browser opened in the same session, then is must be specified in every call to Open Browser.
Merge pull request #258 from ombre42/master