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

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

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

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

      Firefox + Selenium WebDriver 并自动下载 csv 文件

      时间:2023-07-04
          <tbody id='Jsy6K'></tbody>

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

              1. <small id='Jsy6K'></small><noframes id='Jsy6K'>

                本文介绍了Firefox + Selenium WebDriver 并自动下载 csv 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我对 Selenium WebDriver 和 Firefox 有疑问.我想下载 csv 文件而不在对话框窗口中确认,我有这样的代码:

                I have problem with Selenium WebDriver and Firefox. I want to download csv file without confirmation in dialog window and I have code like this:

                fp = webdriver.FirefoxProfile()
                fp.set_preference("browser.download.folderList",2)
                fp.set_preference("browser.download.dir", download_dir)
                fp.set_preference("browser.download.manager.showWhenStarting",False)
                fp.set_preference("browser.helperApps.neverAsk.saveToDisk","text/csv")
                

                但它似乎不起作用.我尝试了许多与 browser.helperApps.neverAsk.saveToDisk

                but it seems not working. I tried many combination with browser.helperApps.neverAsk.saveToDisk

                fp.set_preference("browser.helperApps.neverAsk.saveToDisk","text/csv,application/csv,text/plan,text/comma-separated-values")
                

                fp.set_preference("browser.helperApps.neverAsk.saveToDisk","application/csv")
                fp.set_preference("browser.helperApps.neverAsk.saveToDisk","text/plain")
                fp.set_preference("browser.helperApps.neverAsk.saveToDisk","text/comma-separated-values")
                

                但没有区别,Firefox 不会自动下载.我该如何解决?

                but there's no difference and Firefox won't download automaticly. How can I fix it?

                推荐答案

                有时内容类型不符合您的预期使用 HttpFox Firefox 插件(或类似插件)查找文件的真实内容类型并在您的代码中使用它

                Sometime the content type is not as you'd expect Use HttpFox Firefox plugin (or similar) to find the real content type of the file and use it in your code

                顺便说一句,对我来说内容类型是

                BTW, For me the content type was

                fp.set_preference("browser.helperApps.neverAsk.openFile", "application/octet-stream");
                fp.set_preference("browser.helperApps.neverAsk.saveToDisk", "application/octet-stream");
                

                这篇关于Firefox + Selenium WebDriver 并自动下载 csv 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:Selenium python find_element_by_class_name() 从 v 2.2 到 2.21 下一篇:使用 Selenium Webdriver (Python) 循环链接

                相关文章

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

                <tfoot id='VcgAl'></tfoot>

                1. <i id='VcgAl'><tr id='VcgAl'><dt id='VcgAl'><q id='VcgAl'><span id='VcgAl'><b id='VcgAl'><form id='VcgAl'><ins id='VcgAl'></ins><ul id='VcgAl'></ul><sub id='VcgAl'></sub></form><legend id='VcgAl'></legend><bdo id='VcgAl'><pre id='VcgAl'><center id='VcgAl'></center></pre></bdo></b><th id='VcgAl'></th></span></q></dt></tr></i><div id='VcgAl'><tfoot id='VcgAl'></tfoot><dl id='VcgAl'><fieldset id='VcgAl'></fieldset></dl></div>
                  1. <legend id='VcgAl'><style id='VcgAl'><dir id='VcgAl'><q id='VcgAl'></q></dir></style></legend>
                  2. <small id='VcgAl'></small><noframes id='VcgAl'>