【问题标题】:selenium webdriver with javascript : how to allow chrome to download multiple files?带有 javascript 的 selenium webdriver:如何允许 chrome 下载多个文件?
【发布时间】:2021-02-27 17:56:30
【问题描述】:

https://www.selenium.dev/documentation/en/webdriver/js_alerts_prompts_and_confirmations/这样查看文档数小时

https://chromedriver.chromium.org/capabilities

https://peter.sh/experiments/chromium-command-line-switches/

我找不到任何使用带有 javascript 的 selenium webdriver 来允许多个下载文件的解决方法。以为我可以找到这样的功能,但我找不到。

我也试过这个

await driver.switchTo().alert().accept()
await driver.executeScript("window.confirm = function(){return true}")

效果也不好。

【问题讨论】:

    标签: javascript google-chrome selenium-webdriver


    【解决方案1】:

    尝试设置偏好

    var options = new chromeDriver.Options();
    options.setUserPreferences({"profile.default_content_setting_values.automatic_downloads" : 1});
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-03
      • 1970-01-01
      • 2018-04-06
      相关资源
      最近更新 更多