How to handle Chrome's 'Download multiple files' alert

While I’m not the first to ask about this, I’ve yet to find any solutions, so curious if anyone has had any luck. This is an age old problem in the chromedriver/selenium community, and the correct approach is constantly changing…

When executing a test in Chrome that, at some point, downloads multiple files from an app, the following alert will occur:

image

Making a selection upon seeing this alert is equivalent to configuring the following browser setting manually:

Settings > Advanced > Privacy and security > Content settings > Automatic downloads

This is not new; it’s apparently Chrome trying to mimic a similar security feature that Firefox uses. What is new, and constantly changing, is how the user’s choice of ‘Allow’ or ‘Block’ get stored/handled in the Preferences file for the browser. Below is the relevant JSON object that stores this setting in the prefs file. This is how it looks BEFORE allowing multiple file downloads:

image

Here’s how it looks AFTER you click ‘Allow’, or set it yourself in the settings:

image

Great, so we have a property that we can set using Desired Capabilities, right?:

Except that this property never gets injected once the driver is instantiated!

image

And here’s the real kicker: I don’t think it’s chromedriver’s fault. I believe that Chrome is (somehow) blocking the programmatic setting of this specific property, and (somehow) allowing only a manual user to make this configuration. To prove it, lets try putting an intentional typo in there:

image

Strangely, chromedriver has no problem injecting this property…:

image

Queue ominous X-Files theme song…

I’ve tried using essentially every single desired capability that’s ever been suggested, but to no avail :disappointed_relieved: Has anyone else had any luck with this?

Chrome version: 71.0.3578.80 (Official Build) (32-bit)

Thanks in advance!

3 Likes

I feel your pain, Brandon.

What’s annoying and quite alarming, is the dismissive and uncaring message sent out by the driver devs via the “responses” (note the quotes) on the bug.

I’m wondering if Canary might take a more relaxed approach (but if the denial is in the driver, then perhaps not).

1 Like

No kidding :weary:

Hi Brandon,

I have found one solution you can try it at your end. It worked out for me and multiple download pop-up is not displayed now. Add below capability to your Chrome browser.

prefs:-> profile.default_content_setting_values.automatic_downloads : 1.0

3 Likes

Hi @rohel.dawoodani. I will give it a try, thanks!

I can confirm that your solution works. Thank you so much!