I have 10 test cases, In which first 8 test cases should run in Chrome browser and next 2 test cases should run in Firefox browser.

I have tried below code: in conf.js

  var jasmineReporters = require('jasmine-reporters-master');

  var SpecReporter = require('jasmine-spec-reporter').SpecReporter;
  var Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter');

  exports.config = {
framework: 'jasmine2',      //framework Used
seleniumPort: 4444,         // selenium port address
    specs: ['./Spec/Master.spec.js'],      //Spec -> consists of test suite/ test cases
allScriptsTimeout: 50000,
jasmineNodeOpts: {                   //jasmine framework details
    isVerbose: true,
    showColors: true,
    includeStackTrace: true,
    defaultTimeoutInterval: 260000,
    print: function() {}

    multiCapabilities: [{
    browserName: 'chrome',
    'args':['incognito','--start-maximized'],  // this line is for maximize the window and incognito view

    prefs: {
        'profile:managed_default_content_settings.notifications': 1
    exclude: ['./Spec/RestCall/ShowGeoLocation.js'],

        browserName: 'firefox',
        specs: ['./Spec/RestCall/ShowGeoLocation.js']
        // Spec files to be excluded on this capability only.
        //exclude: ['spec/doNotRunInChromeSpec.js'], //YOUR SPEC NAME THAT YOU WANT TO EXCLUDE/SKIP

onPrepare: function (config_) {                  // before starting the actual TC execution, setup the things we define here

    var jasmineReporters = require('jasmine-reporters');
    jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter({
        consolidateAll: false,
        savePath: './Reports/JunitXMLprotractor-result/',
        filePrefix: 'xmloutput'



./Spec/Master.spec.js' has:

       var showGeoloca = require('./RestCall/ShowGeoLocation');

       describe('REPORTING USER ROLE - ',function () {
    Reporting.start();         contains actual spec

       describe('Rest Call - ',function () {
       showGeoloca.start();          contains actual spec

In Simple, Reporting.start() should run in Chrome browser. ShowGeoloca.start should run in Firefox browser.

Note: Inside Each Spec code, I didn’t specify any new instance of creating new browser

But didn't work as expected.

How can we achieve this? Can we create a new instance of Firefox browser on the go? (while a test case is running)

  • Thanks for the update. Most importantly, I wanted to see the actual specs values, not the sample ones. Directory structure showing how your tests are organized would also help a lot.
    – alecxe
    Commented Sep 14, 2017 at 13:14
  • pls check now @alecxe . I dont like you to confuse by posting more code. Simply put, we are giving info about browser run for Spec in common in Conf.js (mutliple capabilities). My Question: Where to specify for spec 1 run against Chrome and Spec 2 run against firefox.
    – Bustaq
    Commented Sep 14, 2017 at 13:31

1 Answer 1


I think what you're looking for is the getCapabilities method for the browser global. In general this would work something like the following if you went down this path. Personally, I'd consider how you might break this down into multiple test scenarios without conditional logic guiding the expected outcome.

browser.getCapabilities().then(function(caps) {
  if (caps.get('browserName') === 'chrome') {
    // do something related to chrome
  • thanks Cheree. where to specify the above code you said. My Question is Where and how to tell protractor to run few test case on CHROME and few testcase on FIREFOX
    – Bustaq
    Commented Sep 15, 2017 at 13:12
  • 1
    Keasav, I think you'd have a couple options to get closer to that outcome. 1) Break out browsers with lots of specific scenarios/workflows into their own config files. Then you'd have the option of using either filepath filters or regular expression filters against test names to limit what is run. 2) Break out browser-limited test cases into their own files. Use "specs" or "exclude" in the capabilities object to include or exclude as appropriate.
    – Cherree
    Commented Sep 17, 2017 at 3:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.