Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Protractor error message "unsupported command-line flag" in Chrome?

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?

like image 632
mikeybaby173 Avatar asked May 21 '14 00:05

mikeybaby173


3 Answers

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

capabilities : {
    browserName : 'chrome',
    'chromeOptions': {
        args: ['--test-type']
    }
},
like image 161
scheffield Avatar answered Oct 14 '22 02:10

scheffield


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.

like image 29
Luke S. Avatar answered Oct 14 '22 03:10

Luke S.


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 **

like image 13
mishmaccas Avatar answered Oct 14 '22 04:10

mishmaccas