32
votes

I'm a new user to Protractor, and I encountered this error running my tests using Chrome (error displays beneath the address bar in the launched browser):

You are using an unsupported command-line flag --ignore-certificate-errors. Stability and security will suffer.

Here is my conf.js for Protractor:

exports.config = {

seleniumAddress: 'http://localhost:4444/wd/hub',
capabilities: {
    'browserName': 'chrome'  
},

...

Also, I am using a Mac with the latest available Chromedriver and Selenium standalone server (2.41.0). Now, I haven't set this flag anywhere, and I don't recall it always displaying so I'm not sure what caused this problem.

Any ideas on how to resolve this issue?

9
I just started getting this today too. I'm wondering if Chrome was updated in the background and no longer works correctly in this context. I updated 'browserName': 'chrome' to 'browserName': 'firefox'. I noticed that failed tests dump better information with Firefox, so I'm going to continue using Firefox anyway. - Charlie
Having same issue, Where is this flag being set? does anybody know? - Fred
I just started getting this today (2017-04-03), even though my capybara suite worked last week. Grrrr - Jason FB

9 Answers

34
votes

If you use Protractor, this is probably the configuration you're looking for:

capabilities : {
    browserName : 'chrome',
    'chromeOptions': {
        args: ['--test-type']
    }
},
29
votes

The flag --ignore-certificate-errors has been added to the "bad flags" list as of Chrome 35, since it reduces the browser's security. The flag still works regardless.

If you'd like to disable the "unsupported flag" prompt, add --test-type to the command-line flags you're using. This shouldn't affect the browser in any other noticeable way, but it's used for internal testing, so use it at your own risk.

For more info on adding command-line flags, see the Chromedriver capability docs.

13
votes
System.setProperty("webdriver.chrome.driver","<<your chrome path>>");
    // To remove message "You are using an unsupported command-line flag: --ignore-certificate-errors.
    // Stability and security will suffer."
    // Add an argument 'test-type'
    DesiredCapabilities capabilities = DesiredCapabilities.chrome();
    ChromeOptions options = new ChromeOptions();
    options.addArguments("test-type");
    capabilities.setCapability("chrome.binary","<<your chrome path>>");
    capabilities.setCapability(ChromeOptions.CAPABILITY, options);

    driver = new ChromeDriver(capabilities);

**This worked for me too here is the code **

7
votes

I think this is a Chromedriver issue, I've raised an issue against Chromedriver https://code.google.com/p/chromedriver/issues/detail?id=799

In the meantime you can try downgrading Chrome to v34.

2
votes

This error also happened for me when I tried to run "npm run protractor" on step 3 of the Angular tutorial at https://docs.angularjs.org/tutorial/step_03

I'm running Chrome Version 35.0.1916.153 on a MacBook Pro.

@scheffield - thanks, your solution worked for me.

(Also it may not be obvious on that tutorial step 3, but as in previous steps, you still have to start your web server by opening a new terminal window in the directory where you downloaded the tutorial and issuing "npm start". Then in a separate terminal window you execute "npm run protractor"). With the protractor config tweak the error went away.

1
votes

Selenium using C#.Net (Selenium + C#.Net)

public static IWebDriver Instance = null;
ChromeOptions opt = new ChromeOptions();

opt.AddArguments("--test-type");<br><br>
Instance = new ChromeDriver(@"Path To directory containing chromedriver.exe" , opt ) ;

It works for Google Chrome Version 47.0.2526.106 m.

0
votes

Code that worked for both local webdriver and remote driver scenarios for Ruby Bindings. This suppressed the warning message on chrome35 (Remember that you have to get 2.10 chromedriver.exe from http://chromedriver.storage.googleapis.com/index.html)

Localwebdriver:

caps = Selenium::WebDriver::Remote::Capabilities.chrome("chromeOptions" => {"args" => ["test-type" ]})

@browser = Selenium::WebDriver.for :chrome,desired_capabilities: caps

RemoteWebDriver (using GRID): Note that comma-separated-ips in the below code are the ips from which the grid hub is allowed to receive selenese commands. This security layer has been implemented from chrome35 and chromedriver 2.10 onwards

caps = Selenium::WebDriver::Remote::Capabilities.chrome("chromeOptions" => {"args" => ["test-type","whitelisted-ips=comma-separated-ips"]})

@browser =  Selenium::WebDriver.for :remote, :url => GRID_HUB_URL,:desired_capabilities => caps
0
votes
#!/usr/bin/env node
var webdriver = require('selenium-webdriver');
var driver = new webdriver.Builder().withCapabilities({
    browserName : 'chrome',
    'chromeOptions': {
        args: ['test-type']
    }
}).build();
0
votes

I am using Java, so I don't know if this will work for you, but it may help.

In my case, adding .addArguments("test-type"); did actually hide that warning. However, it made execution amazingly slow.

So I replaced that line with the following, and it worked fine!

options.addArguments("excludeSwitches", "ignore-certificate-errors");