Unable to set capabilities on Chrome WebDriver
See original GitHub issueI am trying to use pytest-splinter
fixtures splinter_webdriver
and splinter_driver_kwargs
to enable Chrome to run in Incognito mode and ignore certificate errors to enable testing from a local dev environment versus a hosted site with valid certs.
I am unable to find the combination of arguments that make Chrome work, and conversely, make Firefox break.
When I do not use the fixtures and just create my own splinter Browser instance it works fine.
@pytest.fixture(scope='session')
def my_browser():
caps = webdriver.DesiredCapabilities.CHROME.copy()
caps["acceptInsecureCerts"] = True
caps["acceptSslCerts"] = True
browser = Browser('chrome', incognito=True, desired_capabilities=caps)
return browser
However, in my desired scenario, when splinter_webdriver
returns “chrome” and splinter_driver_kwargs
returns any of the following configurations, the invalid cert authority error has not been bypassed. Also, of note, attempting to override the capabilities for FireFox and force it to fail on the invalid certs also does not work.
def splinter_driver_kwargs():
chrome_options = webdriver.ChromeOptions()
chrome_options.set_capability("acceptInsecureCerts", True)
chrome_options.set_capability("acceptSslCerts", True)
# caps = webdriver.DesiredCapabilities.CHROME.copy()
# caps["acceptInsecureCerts"] = True
# caps["acceptSslCerts"] = True
# XXX just a test to try and break FF on insecure certs, but it does not work =(
# caps = webdriver.DesiredCapabilities.FIREFOX.copy()
# caps["acceptInsecureCerts"] = False
return {
"incognito": True,
"options": chrome_options,
# "capabilities": caps,
# "desired_capabilities": caps
}
What are the recommended steps in this case?
Thanks.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (2 by maintainers)
Top GitHub Comments
Found it:
from selenium import webdriver
Merged #167. Closing this issue, as the documentation in #167 somehow explains what to do in case reported by @aahamlin . On the other hand, if you need any other assistance, please reopen.