Skip to content Skip to sidebar Skip to footer

How To Bypass The Message-"your Connection Is Not Private" On Non-secure Page Using Selenium?

I'm trying to interact with the page 'Your connection is not private'. The solution of using options.add_argument('--ignore-certificate-errors') is not helpful for two reasons: I'

Solution 1:

For chrome:

from selenium importwebdriveroptions= webdriver.ChromeOptions()
options.add_argument('--ignore-ssl-errors=yes')
options.add_argument('--ignore-certificate-errors')
driver = webdriver.Chrome(options=options)

If not work then this:

from selenium import webdriver
from selenium.webdriver import DesiredCapabilities

options = webdriver.ChromeOptions()
options.add_argument('--allow-insecure-localhost') # differ on driver version. can ignore. 
caps = options.to_capabilities()
caps["acceptInsecureCerts"] = True
driver = webdriver.Chrome(desired_capabilities=caps)

For firefox:

from selenium importwebdriverprofile= webdriver.FirefoxProfile()
profile.accept_untrusted_certs = Truedriver= webdriver.Firefox(firefox_profile=profile)
driver.get('https://cacert.org/')

driver.close()

If not work then this:

capabilities = webdriver.DesiredCapabilities().FIREFOX
capabilities['acceptSslCerts'] = True
driver = webdriver.Firefox(capabilities=capabilities)
driver.get('https://cacert.org/')
driver.close()

Above all worked for me!

Solution 2:

This is how i handle this problem:

import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.CapabilityType;

ChromeOptionscapability=newChromeOptions();
capability.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
capability.setCapability(CapabilityType.ACCEPT_INSECURE_CERTS,true);

WebDriverdriver=newChromeDriver(capability);

Solution 3:

This chrome option is the silver bullet for me:

 chromeOptions.addArguments("--allow-running-insecure-content");

If you need more, Open chrome & paste this URL:

        chrome://flags/

One will find all the options and their impact on the chrome.

Solution 4:

Either of below 2 solutions worked for me using Python Chrome Selenium Webdriver:

from selenium import webdriver
from selenium.webdriver import DesiredCapabilities

capabilities = DesiredCapabilities.CHROME.copy()
capabilities["acceptInsecureCerts"] = True
driver = webdriver.Chrome(desired_capabilities=capabilities)

And accepted solution:

from selenium importwebdriveroptions= webdriver.ChromeOptions()
options.add_argument('--ignore-ssl-errors=yes')
options.add_argument('--ignore-certificate-errors')
driver = webdriver.Chrome(options=options)

Post a Comment for "How To Bypass The Message-"your Connection Is Not Private" On Non-secure Page Using Selenium?"