<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 文件

      Firefox + Selenium WebDriver and download a csv file automatically(Firefox + Selenium WebDriver 并自动下载 csv 文件)
          <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 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                相关文档推荐

                env: python: No such file or directory(env: python: 没有这样的文件或目录)
                How to evaluate environment variables into a string in Python?(如何在 Python 中将环境变量评估为字符串?)
                Python - temporarily modify the current process#39;s environment(Python - 临时修改当前进程的环境)
                Change current process environment#39;s LD_LIBRARY_PATH(更改当前进程环境的 LD_LIBRARY_PATH)
                Reading and writing environment variables in Python?(在 Python 中读写环境变量?)
                When to use sys.path.append and when modifying %PYTHONPATH% is enough(何时使用 sys.path.append 以及何时修改 %PYTHONPATH% 就足够了)
                  <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>
                        • <legend id='VcgAl'><style id='VcgAl'><dir id='VcgAl'><q id='VcgAl'></q></dir></style></legend>
                        • <small id='VcgAl'></small><noframes id='VcgAl'>

                            <tbody id='VcgAl'></tbody>