32

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?

mikeybaby173
  • 1,302
  • 2
  • 13
  • 26
  • 2
    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 May 21 '14 at 03:13
  • 1
    Having same issue, Where is this flag being set? does anybody know? – Fred May 28 '14 at 22:03
  • I just started getting this today (2017-04-03), even though my capybara suite worked last week. Grrrr – Jason FB Apr 03 '17 at 12:57

9 Answers9

34

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

capabilities : {
    browserName : 'chrome',
    'chromeOptions': {
        args: ['--test-type']
    }
},
scheffield
  • 6,618
  • 2
  • 30
  • 31
  • 2
    I believe elements in chromeOptions don't require the leading `--` See the example in the docs here: https://github.com/angular/protractor/blob/master/docs/browser-setup.md#adding-chrome-specific-options – Tony T Aug 13 '14 at 20:56
29

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.

Luke S.
  • 476
  • 2
  • 7
  • 12
  • 2
    Can you please elaborate on this? My tests are no longer working because of this issue. I've tried starting protractor from the command-line using the following command without any luck: >node node_modules\grunt-protractor-runner\node_modules\protractor\bin\webdriver-manager start --test-type – user3284007 May 26 '14 at 12:23
  • 2
    --test-type doesn't actually suppress the message, at least for me. – user1205577 Oct 02 '14 at 17:26
  • where can one find the "bad flags list"? – johny why Feb 03 '16 at 10:53
13
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 **

mishmaccas
  • 131
  • 3
7

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.

JimCresswell
  • 164
  • 1
  • 3
2

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.

David Barrows
  • 758
  • 7
  • 20
  • Thank you @David Barrows, I'm in the exactly situation as you and your answer helped me solve the problem. – Tony Mar 18 '15 at 19:30
  • I tried to run Protractor without the web server running, and I got the error above. It took me a few minutes to realize that Protractor requires that the server be running, and Karma does not, during testing. – ian-campbell Jul 01 '15 at 23:28
1

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.

Sam Hanley
  • 4,707
  • 7
  • 35
  • 63
Avinash Pande
  • 1,510
  • 19
  • 17
0

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
machzqcq
  • 1,029
  • 13
  • 15
0
#!/usr/bin/env node
var webdriver = require('selenium-webdriver');
var driver = new webdriver.Builder().withCapabilities({
    browserName : 'chrome',
    'chromeOptions': {
        args: ['test-type']
    }
}).build();
0

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");
ndarriulat
  • 749
  • 1
  • 9
  • 11