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"
}
)
]);
},
// ...
}
它引发以下错误:
请分享您的观点以解决此问题。
最佳答案
您需要安装q
和firefox-profile
模块:
npm install q firefox-profile --save-dev