如何在chimp.js中使用Firefox配置文件?

如何在chimp.js中使用Firefox配置文件?,firefox,automation,profile,webdriver-io,chimp.js,Firefox,Automation,Profile,Webdriver Io,Chimp.js,我正在运行chimp来自动化我的一些测试用例。在其中一种情况下,我必须下载一个文件并检查文件大小是否匹配。通过在chimp配置文件的Webdriver.io部分中定义以下pref,我能够在chrome中单击其链接时自动下载该文件: prefs:{“profile.default\u content\u settings.popups”:false,“download.default\u目录”:“/downloads”} 现在,我正试图用Firefox做同样的事情。然而,我仍然无法做到这一点。我读

我正在运行chimp来自动化我的一些测试用例。在其中一种情况下,我必须下载一个文件并检查文件大小是否匹配。通过在chimp配置文件的Webdriver.io部分中定义以下pref,我能够在chrome中单击其链接时自动下载该文件:

prefs:{“profile.default\u content\u settings.popups”:false,“download.default\u目录”:“/downloads”}

现在,我正试图用Firefox做同样的事情。然而,我仍然无法做到这一点。我读到需要创建firefox配置文件并传递以下firefox首选项:

"browser.download.folderList",2
"browser.download.manager.showWhenStarting",false
"browser.download.dir", "/save/file/to/this/directory"
"browser.helperApps.neverAsk.saveToDisk","text/html, application/xhtml+xml, application/xml, application/csv, text/plain, application/vnd.ms-excel, text/csv, text/comma-separated-values, application/octet-stream"
在chimp配置文件的Webdriver.io部分有没有一种方法可以做到这一点,就像我在Chrome上做的那样

顺便说一下,我确实安装了npm包firefox配置文件。尝试使用下面的代码在步骤defs中直接启动浏览器,但出现以下错误:

[chimp]检测到未处理的弹出: [chimp][hooks]错误:无法在末尾连接到selenium服务器()

this.Given(/^The Home page with FF profile$/, function () {
    let fp = new FirefoxProfile();
    fp.setPreference("browser.download.folderList",2);
    fp.setPreference("browser.download.manager.showWhenStarting",false);
    fp.setPreference("browser.download.dir", "./downloads");
    fp.setPreference("browser.helperApps.neverAsk.saveToDisk","text/html, application/xhtml+xml, application/xml, application/csv, text/plain, application/vnd.ms-excel, text/csv, text/comma-separated-values, application/octet-stream");

     fp.encoded(function(prof) {

      let client = webdriverio.remote({
        desiredCapabilities: {
          browserName: 'firefox',
          firefox_profile: prof
        }
      });

      client
        .init()
        .url("www.google.com.br", shared.defaultTimeout)
        .pause(10000)
        .end();

    });
有人能帮忙吗