close

How to bypass the message-“your connection is not private” on non-secure page using Selenium?

Hello Guys, How are you all? Hope You all Are Fine. Today We Are Going To learn about How to bypass the message-“your connection is not private” on non-secure page using Selenium in Python. So Here I am Explain to you all the possible Methods here.

Without wasting your time, Let’s start This Article.

How to bypass the message-“your connection is not private” on non-secure page using Selenium?

  1. How to bypass the message-“your connection is not private” on non-secure page using Selenium?

    This is how i handle this problem:
    import org.openqa.selenium.chrome.ChromeOptions; import org.openqa.selenium.remote.CapabilityType;

  2. bypass the message-“your connection is not private” on non-secure page using Selenium

    This is how i handle this problem:
    import org.openqa.selenium.chrome.ChromeOptions; import org.openqa.selenium.remote.CapabilityType;

Method 1

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)

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 import webdriver

profile = webdriver.FirefoxProfile()
profile.accept_untrusted_certs = True

driver = 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!

Method 2

This is how i handle this problem:

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

ChromeOptions capability = new ChromeOptions();
capability.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
capability.setCapability(CapabilityType.ACCEPT_INSECURE_CERTS,true);

WebDriver driver = new ChromeDriver(capability);

Summery

It’s all About this issue. Hope all Methods helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which Method worked for you? Thank You.

Also, Read