1

I am using the latest selenium chromedriver_win32_2.25 driver. Today after I updated the my Chrome to 54.0.2840.87. I can not do the auto downloading. The Chrome will pop up and window "XXX.zip is malicious, and Chrome has blocked it" . I found out I can disable this alert by turning off the Chrome option "Protect you and your device from dangerous sites". This is the opposite way to allowing auto download before (Check the post How to disable 'This type of file can harm your computer' pop up)

The following code is not working:

        Map<String, Object> prefs = new HashMap<String, Object>();
        prefs.put("safebrowsing.enabled", "false");
        prefs.put("safebrowsing.malware.enabled", "false");
        prefs.put("download.prompt_for_download", "false"); 
        prefs.put( "profile.content_settings.pattern_pairs.*.multiple-automatic-downloads", 1 );
        prefs.put("download.default_directory", downloadDir);           
        options.setExperimentalOption("prefs", prefs);

Not sure what is the lastest parameters for the "Protect you and your device from dangerous sites"

Seems prefs.put("safebrowsing.enabled", "false"); not working.

Community
  • 1
  • 1
Peter
  • 65
  • 8

1 Answers1

1

I had a similar problem. After a bit of research, I tried:

options.AddUserProfilePreference("profile.default_content_setting_values.automatic_downloads", 1);

rather than my original:

options.AddUserProfilePreference("profile.content_settings.pattern_pairs.*,*.multiple-automatic-downloads", 1);

...and it worked just fine, now. This is when I went to Chrome 52.0.2743.116 m.

  • Thanks for your input. After I tried many times, it is always working whether "safebrowsing.enabled" is "false" or "ture". This is fixed automatically. – Peter Nov 03 '16 at 23:00
  • What language is in your answer, php? Do you have a version in good old javascript? I'm using Chrome. It gave me Yes/NO prompt (not desirable!) for downloading multiple files. All I need is setting multiple-automatic-downloads" to 1 (true) !! Because I do not want to see the prompt asking it. – Jenna Leaf Jan 26 '18 at 16:32