How do i overwrite protractor.conf.js values from the command line?

All we need is an easy explanation of the problem, so here it is.

I currently have protractor setup to run on our integration server. Inside the protractor.conf.js file i have the following:

 multiCapabilities: [{
    'browserName': 'firefox',
    'platform': 'MAC'
  }, {
    'browserName': 'chrome',
    'platform': 'MAC'
  }]

I would like to override this when running locally from the command line. I’ve tried the following with no success

protractor --verbose --browser=chrome

Question: How do i switch to only using a single instance of chrome when running locally from the command line?

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

This is a problem.

According to the source code, browser command line argument is an alias of capabilities.browserName.

According to the referenceConf.js documentation:

// If you would like to run more than one instance of WebDriver on the same
// tests, use multiCapabilities, which takes an array of capabilities.
// If this is specified, capabilities will be ignored.
multiCapabilities: [],

In other words, since multiCapabilities are specified, capabilities are ignored.


What you can try to do is to reset multiCapabilities from command-line:

protractor --verbose --browser=chrome --multiCapabilities

As an another workaround, have a separate config file for running a single browser instance.


Also, list of related topics:

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply