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"
}
)
]);
},
// ...
}
它会抛出以下错误:
错误 - 加载配置文件protractor.conf.js失败 /usr/local/lib/node_modules/protractor/lib/configParser.js:183 扔掉; ^错误:找不到模块'q'
请分享您的观点以解决此问题。
答案 0 :(得分:0)
您需要安装q
和firefox-profile
个模块:
npm install q firefox-profile --save-dev