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

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

        <tfoot id='K1q7d'></tfoot>

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

        <legend id='K1q7d'><style id='K1q7d'><dir id='K1q7d'><q id='K1q7d'></q></dir></style></legend>

      1. 如何在 Java 中通过 Firefox Profile 下载 CSV 文件

        How to download CSV file through Firefox Profile in Java(如何在 Java 中通过 Firefox Profile 下载 CSV 文件)
          <tbody id='WkUtG'></tbody>

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

        • <legend id='WkUtG'><style id='WkUtG'><dir id='WkUtG'><q id='WkUtG'></q></dir></style></legend>

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

              <bdo id='WkUtG'></bdo><ul id='WkUtG'></ul>

                1. <tfoot id='WkUtG'></tfoot>
                2. 本文介绍了如何在 Java 中通过 Firefox Profile 下载 CSV 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  问题 - 设置 Firefox 配置文件后,Firefox 在下载 CSV 文件时不断询问下载位置.请帮忙.

                  Question - After Setting Firefox profile, Firefox keeps asking download location when downloading CSV file. Please help.

                  System.setProperty("webdriver.gecko.driver", "..\C_Automation\Files\geckodriver64_15.0.exe");
                          FirefoxProfile Profile = new FirefoxProfile();
                          Profile.setPreference("browser.download.dir",downloadFilepath);
                          Profile.setPreference("browser.download.folderList",2);
                          Profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "text/csv");
                          Profile.setPreference("browser.download.manager.showWhenStarting",false);
                          Profile.setPreference("browser.helperApps.neverAsk.openFile","text/csv");
                          Profile.setPreference("browser.helperApps.alwaysAsk.force", false);
                          driver = new FirefoxDriver(Profile);
                  

                  推荐答案

                  我在您的代码中没有发现任何重大问题.但是,当您为 FirefoxProfilesetPreference 时,请记住添加此 Multipurpose Internet Mail Extensions="http://mimeapplication.net/" rel="nofollow noreferrer">网站.

                  I don't see any major issue in your code. But while you setPreference for the FirefoxProfile Class do remember to add all the relevant Multipurpose Internet Mail Extensions of CSV type files referred in this site.

                  这是您自己的代码块,其中添加了一些简单的调整:

                  Here is your own code block with some simple tweaks added to it:

                  String downloadFilepath = "C:\Utility\OP_Resources\MozillaFirefoxDownload";
                  System.setProperty("webdriver.gecko.driver", "C:\Utility\BrowserDrivers\geckodriver.exe");
                  FirefoxProfile Profile = new FirefoxProfile();
                  Profile.setPreference("browser.download.dir",downloadFilepath);
                  Profile.setPreference("browser.download.folderList",2);
                  //neverAsk - saveToDisk - CSV        
                  Profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "application/csv,application/excel,application/vnd.ms-excel,application/vnd.msexcel,text/anytext,text/comma-separated-values,text/csv,text/plain,text/x-csv,application/x-csv,text/x-comma-separated-values,text/tab-separated-values");
                  //neverAsk - saveToDisk - ANY       
                  Profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "application/xml,text/plain,text/xml,image/jpeg,application/octet-stream");
                  Profile.setPreference("browser.download.manager.showWhenStarting",false);
                  //neverAsk - openFile - CSV
                  Profile.setPreference("browser.helperApps.neverAsk.openFile","application/csv,application/excel,application/vnd.ms-excel,application/vnd.msexcel,text/anytext,text/comma-separated-values,text/csv,text/plain,text/x-csv,application/x-csv,text/x-comma-separated-values,text/tab-separated-values");
                  //neverAsk - openFile - ANY
                  Profile.setPreference("browser.helperApps.neverAsk.openFile","application/xml,text/plain,text/xml,image/jpeg,application/octet-stream");
                  Profile.setPreference("browser.helperApps.alwaysAsk.force", false);
                  

                  我已在此 网站 和 Microsoft 验证了我的代码site 在我看来工作正常.

                  I have verified my code on this site and Microsoft site as well and seems to me works fine.

                  这篇关于如何在 Java 中通过 Firefox Profile 下载 CSV 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How to send data to COM PORT using JAVA?(如何使用 JAVA 向 COM PORT 发送数据?)
                  How to make a report page direction to change to quot;rtlquot;?(如何使报表页面方向更改为“rtl?)
                  Use cyrillic .properties file in eclipse project(在 Eclipse 项目中使用西里尔文 .properties 文件)
                  Is there any way to detect an RTL language in Java?(有没有办法在 Java 中检测 RTL 语言?)
                  How to load resource bundle messages from DB in Java?(如何在 Java 中从 DB 加载资源包消息?)
                  How do I change the default locale settings in Java to make them consistent?(如何更改 Java 中的默认语言环境设置以使其保持一致?)
                    <bdo id='Hlvsd'></bdo><ul id='Hlvsd'></ul>

                    • <tfoot id='Hlvsd'></tfoot>

                        <tbody id='Hlvsd'></tbody>

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

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

                        1. <legend id='Hlvsd'><style id='Hlvsd'><dir id='Hlvsd'><q id='Hlvsd'></q></dir></style></legend>