【发布时间】:2017-12-15 19:30:20
【问题描述】:
我正在使用 Protractor 进行 E2E 测试。在自动化过程中,我需要将文件下载到系统中的 C:\Automation 文件夹中。但是下面的代码不起作用。
注意:在自动化执行期间,“另存为”弹出窗口打开(但我以后必须禁用它),然后我手动单击“保存”选项。它保存在默认位置,即下载文件夹。如何让它保存在我给定的路径中。
let profile = require('firefox-profile');
let firefoxProfile = new profile();
//_browser = 'chrome';
_browser = 'firefox';
// _browser = 'internet explorer';
firefoxProfile.setPreference("browser.download.folderList", 2);
firefoxProfile.setPreference('browser.download.dir', "C:\\Automation");
exports.config = {
framework: 'custom',
frameworkPath: require.resolve('protractor-cucumber-framework'),
capabilities: {
'browserName': _browser,
'shardTestFiles': false,
'maxInstances': 1,
'acceptInsecureCerts': true,
'moz:firefoxOptions': {
'profile': firefoxProfile
}},
beforeLaunch: function () {...}
}
【问题讨论】:
标签: firefox protractor firefox-profile