【问题标题】:How to Save in PDF Format Selenium (Python)如何以 PDF 格式保存 Selenium (Python)
【发布时间】:2019-10-14 11:55:24
【问题描述】:

我正在使用 selenium 自动下载一些 pdf 文件。但是,我遇到了一个问题,我需要在以下弹出窗口中单击保存按钮。

我找不到任何使用 Selenium 单击保存按钮的方法。任何建议将不胜感激

【问题讨论】:

  • 您是否尝试使用 Selenium 单击 Enter 或配置您的浏览器以使其在没有提示的情况下开始下载?

标签: python selenium selenium-webdriver


【解决方案1】:

如果你使用壁虎驱动

from selenium.webdriver.firefox.firefox_porfile import FirefoxProfile()
profile = FirefoxProfile()
# Save pdf without asking
profile.set_preference("browser.helperApps.neverAsk.saveToDisk", "application/pdf")

你可以找到其他文件的字幕

https://www.sitepoint.com/mime-types-complete-list/

编辑: 我在这里找到了一个类似的链接:

In selenium python webdriver, I'm not able to download a text file with a .lst extension

【讨论】:

    猜你喜欢
    • 2020-08-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-02
    相关资源
    最近更新 更多