<tfoot id='tlz33'></tfoot>

<small id='tlz33'></small><noframes id='tlz33'>

    1. <i id='tlz33'><tr id='tlz33'><dt id='tlz33'><q id='tlz33'><span id='tlz33'><b id='tlz33'><form id='tlz33'><ins id='tlz33'></ins><ul id='tlz33'></ul><sub id='tlz33'></sub></form><legend id='tlz33'></legend><bdo id='tlz33'><pre id='tlz33'><center id='tlz33'></center></pre></bdo></b><th id='tlz33'></th></span></q></dt></tr></i><div id='tlz33'><tfoot id='tlz33'></tfoot><dl id='tlz33'><fieldset id='tlz33'></fieldset></dl></div>

      1. <legend id='tlz33'><style id='tlz33'><dir id='tlz33'><q id='tlz33'></q></dir></style></legend>
          <bdo id='tlz33'></bdo><ul id='tlz33'></ul>

        使用量角器在 Firefox 上下载文件

        时间:2023-10-12
          <legend id='NPIzA'><style id='NPIzA'><dir id='NPIzA'><q id='NPIzA'></q></dir></style></legend>
              <tbody id='NPIzA'></tbody>
            1. <tfoot id='NPIzA'></tfoot>

                  <bdo id='NPIzA'></bdo><ul id='NPIzA'></ul>
                  <i id='NPIzA'><tr id='NPIzA'><dt id='NPIzA'><q id='NPIzA'><span id='NPIzA'><b id='NPIzA'><form id='NPIzA'><ins id='NPIzA'></ins><ul id='NPIzA'></ul><sub id='NPIzA'></sub></form><legend id='NPIzA'></legend><bdo id='NPIzA'><pre id='NPIzA'><center id='NPIzA'></center></pre></bdo></b><th id='NPIzA'></th></span></q></dt></tr></i><div id='NPIzA'><tfoot id='NPIzA'></tfoot><dl id='NPIzA'><fieldset id='NPIzA'></fieldset></dl></div>

                  <small id='NPIzA'></small><noframes id='NPIzA'>

                • 本文介绍了使用量角器在 Firefox 上下载文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我需要使用量角器在 Firefox 上下载一个 zip 文件.单击下载链接时,会弹出要求打开/保存文件的 Windows 对话框.那么我该如何处理.我需要将哪些参数传递给驱动程序?使用 chrome 我可以做到这一点下载: {'prompt_for_download':假},

                  I need to download a zip file on Firefox with protractor. On clicking on download link, Windows dialog asking to Open/Save the file pops up. So How can I handle that. What args do I need to pass to driver? With chrome I can do that with download: { 'prompt_for_download': false },

                  但是我应该用 Firefox 做什么.

                  but what should i do with firefox.

                  推荐答案

                  问题是 - 您无法通过量角器/硒操作另存为..."对话框.您应该首先避免打开它,让 firefox 自动下载指定 mime 类型的文件 - 在您的情况下为 application/zip.

                  The problem is - you cannot manipulate that "Save As..." dialog via protractor/selenium. You should avoid it being opened in the first place and let firefox automatically download the files of a specified mime-type(s) - in your case application/zip.

                  换句话说,您需要使用自定义 Firefox 来启动 Firefox配置文件设置适当的偏好:

                  In other words, you need to fire up Firefox with a custom Firefox Profile setting the appropriate preferences:

                  var q = require("q");
                  var FirefoxProfile = require("firefox-profile");
                  
                  var makeFirefoxProfile = function(preferenceMap, specs) {
                      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",
                              firefox_profile: encodedProfile,
                              specs: specs
                          };
                  
                          deferred.resolve(capabilities);
                      });
                      return deferred.promise;
                  };
                  
                  exports.config = {
                      getMultiCapabilities: function() {
                          return q.all([
                              makeFirefoxProfile(
                                  {
                                      "browser.download.folderList": 2,
                                      "browser.download.dir": "/path/to/save/downloads",
                                      "browser.helperApps.neverAsk.saveToDisk": "application/zip"
                                  },
                                  ["specs/*.spec.js"]
                              )
                          ]);
                      },
                  
                      // ...
                  }
                  

                  这里我们基本上是在说:Firefox,请自动下载 zip 文件,而不是询问 /path/to/save/downloads 目录.

                  Here we are basically saying: Firefox, please download zip files automatically, without asking into the /path/to/save/downloads directory.

                  这篇关于使用量角器在 Firefox 上下载文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:“角度未定义"对存储在 Liferay 中的角度应用 下一篇:使用量角器在列表中选择第二个锚元素

                  相关文章

                  最新文章

                  <legend id='xnGU1'><style id='xnGU1'><dir id='xnGU1'><q id='xnGU1'></q></dir></style></legend>
                    <tfoot id='xnGU1'></tfoot>
                    <i id='xnGU1'><tr id='xnGU1'><dt id='xnGU1'><q id='xnGU1'><span id='xnGU1'><b id='xnGU1'><form id='xnGU1'><ins id='xnGU1'></ins><ul id='xnGU1'></ul><sub id='xnGU1'></sub></form><legend id='xnGU1'></legend><bdo id='xnGU1'><pre id='xnGU1'><center id='xnGU1'></center></pre></bdo></b><th id='xnGU1'></th></span></q></dt></tr></i><div id='xnGU1'><tfoot id='xnGU1'></tfoot><dl id='xnGU1'><fieldset id='xnGU1'></fieldset></dl></div>

                    • <bdo id='xnGU1'></bdo><ul id='xnGU1'></ul>

                    <small id='xnGU1'></small><noframes id='xnGU1'>