简体   繁体   中英

selenium webdriver with javascript : how to allow chrome to download multiple files?

Looking around documents for hours like https://www.selenium.dev/documentation/en/webdriver/js_alerts_prompts_and_confirmations/

or

https://chromedriver.chromium.org/capabilities

or

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

I was not able to find any workaround with selenium webdriver with javascript to allow multiple download files. Thought I could find such capabilities but I couldn't.

And I also tried this

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

which didn't work as well.

try set the preference

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM