SanBala
SanBala

Reputation: 35

Firefox profile setup throws error in protractor with selenium webdriver configuration

var q = require("q");
var FirefoxProfile = require("firefox-profile");
var makeFirefoxProfile = function(preferenceMap) {

    var deferred = q.defer();
    var firefoxProfile = new FirefoxProfile();

    for (var key in preferenceMap) {
        firefoxProfile.setPreference(key, preferenceMap[key]);
    };

    firefoxProfile.encoded(function (encodedProfile) {
        var capabilities = {
            browserName: "firefox",
            directConnect: true,
            firefox_profile: encodedProfile
        };

        deferred.resolve(capabilities);
    });
    return deferred.promise;
};


exports.config = {
   specs:specs,
   getMultiCapabilities: function() {
       return q.all([
           makeFirefoxProfile(
               {
                   "browser.download.folderList": 2,
                   "browser.download.dir": "/path/to/save/downloads",
                   "browser.helperApps.neverAsk.saveToDisk": "application/zip"
               }
           )
       ]);
   },

  // ...
}

It throws the following error:

ERROR - failed loading configuration file protractor.conf.js /usr/local/lib/node_modules/protractor/lib/configParser.js:183 throw e; ^ Error: Cannot find module 'q'

Please share your views to solve this issue.

Upvotes: 3

Views: 765

Answers (1)

alecxe
alecxe

Reputation: 473833

You need to have q and firefox-profile modules installed:

npm install q firefox-profile --save-dev

Upvotes: 0

Related Questions