6

I am using Capybara with Chrome and Selenium. When I attempt to click on a link that causes an automatic download, the file is downloaded correctly. If I try to do this again, Chrome shows the message: "This site is attempting to download multiple files. Do you want to allow this?"

enter image description here

I was looking for a flag that could be used to disable this message, but couldn't find anything. Is there any way I can get around this message and allow the multiple download without having to resort to a page refresh? (E.g. Is there any way I can click the Allow button programmatically?)

Senseful
  • 86,719
  • 67
  • 308
  • 465

2 Answers2

1

Please see my work-around here:

https://code.google.com/p/chromedriver/issues/detail?id=130#c12

St.Zelenin
  • 32
  • 2
0

Use Chrome Options

WebDriver driver = null;
ChromeOptions options = new ChromeOptions();
        Map<String, Object> prefs = new HashMap<String, Object>();
        prefs.put("profile.default_content_settings.popups", 0);
        prefs.put("profile.content_settings.pattern_pairs.*.multiple-automatic-downloads", 1 );
        //Turns off download prompt
        prefs.put("download.prompt_for_download", false);
        options.setExperimentalOption("prefs", prefs);

    driver = new ChromeDriver(options);