【问题标题】:How to download PDF using ChromeDriver 2.32 and Chrome in version 57 or higher如何使用 ChromeDriver 2.32 和 Chrome 57 或更高版本下载 PDF
【发布时间】:2023-03-23 11:57:01
【问题描述】:

自 57 版以来,Google 确实删除了 chrome://plugins 选项。我发现如果我想下载 PDF 文件而不是在 Chrome 查看器中打开它,我需要打开 chrome://settings/content/pdfDocuments 中的开关

有没有办法在 Chrome 驱动程序中设置此选项,例如使用下面的首选项?

private ChromeOptions BuildChromeProfile()
        {
            var options = new ChromeOptions();

            options.AddUserProfilePreference("download.default_directory", DownloadsPath);
            options.AddUserProfilePreference("download.prompt_for_download", false);
            return options;
        }

或者其他方式?

【问题讨论】:

    标签: c# google-chrome pdf selenium-chromedriver


    【解决方案1】:
    options.AddUserProfilePreference("plugins.always_open_pdf_externally", true);
    

    为我工作。

    【讨论】:

      猜你喜欢
      • 2016-05-10
      • 2020-09-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-07
      • 1970-01-01
      相关资源
      最近更新 更多