Reputation: 35960
What is the correct way of preventing current version of Chrome, running via Selenium, from showing the following dialog:
localhost:8444 wants to download multiple files. Block / Allow.
when the website under test triggers two file downloads? Both files are generated in the browser using URL.createObjectURL()
, Blob
and dynamically appended anchor.
I did try several profile settings described in other answers, but they seem to no longer work with the most recent Chrome 62:
"download.directory_upgrade" "true"
"safebrowsing.enabled" "true"
"profile.content_settings.exceptions.automatic_downloads.https://localhost:8444,*.setting" 1
"profile.content_settings.exceptions.automatic_downloads.https://localhost:8444,*.last_modified" 0
"profile.content_settings.exceptions.automatic_downloads.*.last_modified" 0
"profile.content_settings.exceptions.automatic_downloads.*.setting" 1
"profile.default_content_setting_values.automatic_downloads" 1
"profile.default_content_setting_values.automatic_downloads" 2
I tried all of the above, individually and in certain permutations.
Upvotes: 3
Views: 3749
Reputation: 71
I was also facing the same problem. After updating as mentioned by @FlorentB. its working fine for chrome 66 chrome driver 2.36 webdriver 3.8
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
HashMap<String, Object> chromePrefs = new HashMap<String, Object>();
chromePrefs.put("profile.content_settings.exceptions.automatic_downloads.*.setting", 1);
capabilities.setCapability("chrome.prefs", chromePrefs);
Upvotes: 1