Selenium interacting with: your connection is not private

后端 未结 3 1465
醉酒成梦
醉酒成梦 2021-01-14 10:54

I\'m trying to interact with the page \"Your connection is not private\".

The solution of using options.add_argument(\'--ignore-certificate-errors\') is

3条回答
  •  深忆病人
    2021-01-14 11:54

    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:

    ChromeOptions options = new ChromeOptions()
    chrome_options.add_argument('--allow-insecure-localhost')
    DesiredCapabilities caps = DesiredCapabilities.chrome()
    caps.setCapability(ChromeOptions.CAPABILITY, options)
    caps.setCapability("acceptInsecureCerts", true)
    WebDriver driver = new ChromeDriver(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!

提交回复
热议问题