I have been working with Selenium Web Driver directly with Chrome and Firefox. And one of the things I have encountered when tests are run against my development server is the ‘Connection Is Not Private’ page, which is due to lack of ssl certificate. And this created a problem in my automation scripts as it prevents the scripts from interacting with the page.
The solution is simple, there are corresponding flags that can be set to bypass this page (of course, give we trust ourselves, just kidding).
For Firefox:
1 2 3 4 5 |
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities desired_caps = DesiredCapabilities.FIREFOX.copy() desired_caps.update({'acceptInsecureCerts': True, 'acceptSslCerts': True}) driver = webdriver.Firefox(capabilities=self.desired_caps) |
For chrome:
1 2 3 4 5 6 |
from selenium import webdriver options = webdriver.ChromeOptions() options.add_argument('--ignore-ssl-errors=yes') options.add_argument('--ignore-certificate-errors') driver = webdriver.Chrome(options=options) |
Or you can put it in an arrya like so:
1 2 3 4 |
const chromeArgs = [ '--ignore-ssl-errors=yes', '--ignore-certificate-errors', ]; |
Hope this will be able to help someone who is in need of this.
References: