14

Using Python 2.7.5, python module selenium (2.41.0) and chromedriver (2.9).

When Chrome starts it displays a message in a yellow popup bar: "You are using an unsupported command-line flag: --ignore-certificate-errors. Stability and security will suffer." This simple example reproduces the problem.

from selenium import webdriver
browser = webdriver.Chrome()
browser.get("http://google.com/")

How do I remove this command-line flag in python selenium?

Loknar
  • 1,169
  • 2
  • 13
  • 38

6 Answers6

13

This extra code removes the --ignore-certificate-errors command-line flag for me. In my opinion the arguments that can be added to webdriver.Chrome() could (and should) be better documented somewhere, I found this solution in a comment on the chromedriver issues page (see post #25).

from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_experimental_option("excludeSwitches", ["ignore-certificate-errors"])
browser = webdriver.Chrome(chrome_options=options)
browser.get("http://google.com/")
Loknar
  • 1,169
  • 2
  • 13
  • 38
  • 1
    Tried but didn't work for me (Python 2.7.8, selenium 2.42.1... not sure which driver version I'm using... and Chrome is version 37.0.2062.120 m. I'm on Windows 7 with SP1.) – ArtOfWarfare Sep 16 '14 at 15:00
3

This issue is resolved as of Chromedriver 2.11 (released Oct 2014). Updating will now do the trick.

Shawn Erquhart
  • 1,820
  • 2
  • 17
  • 30
2

you can use the following flag --test-type

            var options = new ChromeOptions();
            options.AddArguments(new[] {
                "--start-maximized",
                "allow-running-insecure-content", 
                "--test-type" });

            return new ChromeDriver(options);
Byron
  • 691
  • 9
  • 9
  • that's javascript, not python, but yeah, there was some way to use the test-type flag to get rid of the popup bar and still ignore certificate errors – Loknar Feb 27 '15 at 10:41
1

This is what I'm currently using in Java to get around this issue but I don't know how Python works but worth a try anyway

ChromeOptions chrome = new ChromeOptions();
chrome.addArguments("test-type");
        capabilities.setCapability(ChromeOptions.CAPABILITY, chrome);
        capabilities.setCapability("chrome.binary",
                "C:\\set path to driver here\\chromedriver.exe");
frass
  • 125
  • 2
  • 18
1
    options = webdriver.ChromeOptions()

    options.add_argument('test-type')
    chromedriver = 'resources/chromedriver.exe'



    os.environ["webdriver.chrome.driver"] = chromedriver

    self.driver = webdriver.Chrome(chromedriver,chrome_options=options)
Nagarjun
  • 11
  • 1
1

I was having this problem using Selenium2 with Robot on a Mac. The problem ended up being that I had the wrong version of chromedriver installed on my system...

$ chromedriver
Starting ChromeDriver (v2.9.248307) on port 9515    <<Version 2.9 was the problem

I found it in /usr/local/bin and just removed it and replaced it from the official download page and it seems to have cleared it all up...

$ chromedriver
Starting ChromeDriver 2.25.426935 (820a95b0b81d33e42712f9198c215f703412e1a1) on port 9515
Only local connections are allowed.
cchapman
  • 3,269
  • 10
  • 50
  • 68