Bharath Kashyap
Bharath Kashyap

Reputation: 343

How to disable the "Insecure Connection" while opening up a private browser from python selenium script?

While running my python selenium script for firefox browser; I encountered an issue saying

Your connection is not secure

It is not allowing me to Add exception and blocked

Confirm Security Exception

as well (even with preferences manually). hence i am trying to add profiles like "webdriver_accept_untrusted_certs", "webdriver_accept_untrusted_certs" but nothing is helping me out. Not sure how to tackle this...

I need some help here

Currently using the following... Python 3.4.4 selenium==3.4.1 linux 32 bit Firefox 60.6.1esr (32-bit) Everything seems to be compatible, so no issue here.

from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import     DesiredCapabilities

cap = DesiredCapabilities().FIREFOX
profile = webdriver.FirefoxProfile()
profile.set_preference("webdriver_assume_untrusted_issuer", False)
profile.update_preferences()
browser = webdriver.Firefox(capabilities=cap,firefox_profile=profile)
browser.get('my url')

and

from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import     DesiredCapabilities

cap = DesiredCapabilities().FIREFOX
profile = webdriver.FirefoxProfile()
profile.set_preference("webdriver_accept_untrusted_certs", True)
browser = webdriver.Firefox(capabilities=cap,firefox_profile=profile)
browser.get('my url')

I want to get rid of the "Your Connection is not secure"

Upvotes: 4

Views: 6782

Answers (1)

Nic Laforge
Nic Laforge

Reputation: 1876

For FireFox you can use:

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:

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)

Upvotes: 4

Related Questions