【问题标题】:How to download a file to a specific path project from UI in Chrome using Python or Selenium?如何使用 Python 或 Selenium 从 Chrome 中的 UI 将文件下载到特定路径项目?
【发布时间】:2020-03-20 10:52:59
【问题描述】:

请告知如何使用 Python 或 Selenium 从 Chrome 中的 UI 下载文件到特定路径项目? UI中有“导出”按钮,系统不建议选择下载位置。它只能通过按鼠标右键来选择。 通过 UI 完成这一点很重要。

【问题讨论】:

    标签: python selenium file user-interface download


    【解决方案1】:

    不幸的是,这不是东方的事。所以要振作起来。

    我能想到两个选择:

    1. 在高级设置 chrome-driver 以自动将文件下载到指定位置
    2. 在 Windows 上创建自动化来执行您需要的操作。

    对于选项 #1:

    explantion on how to set options and preferences to chrome-driver on launch
    请参阅this question 以查找您需要的特定标志。在preferences 链接中我发现了这个:

    const char kPromptForDownload[] = "download.prompt_for_download";
    const char kDownloadDefaultDirectory[] = "download.default_directory";
    

    对于选项 #2:

    为此,我曾经使用 win32-api 来automate the chrome open window
    或者,您可以查看Winium out

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-09-16
      • 2019-05-23
      • 1970-01-01
      • 2019-01-25
      • 2022-08-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多