1

Can't bypass 'This type of file can harm your computer'.

Use Java and Chrome Driver 97+.

Tried:

Map<String, Object> prefs = new HashMap<>();
prefs.put("download.default_directory", "C:\\Users\\Fedor\\Downloads");
prefs.put("download.prompt_for_download", false);
prefs.put("profile.default_content_settings.popups", 0);
prefs.put("safebrowsing.enabled", true);
prefs.put("download.extensions_to_open", "text/x-python");
    
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("prefs", prefs);
options.addArguments("start-maximized");
options.addArguments("--safebrowsing-disable-download-protection");
options.addArguments("--safebrowsing-disable-extension-blacklist");

driver = new ChromeDriver(options);

But no luck... enter image description here

For those who think it's a duplicate, the following links are useless with the current driver version:

1 Answers1

0

Remove the argument:

prefs.put("safebrowsing.enabled", true);

The following arguments:

options.addArguments("--safebrowsing-disable-download-protection");
options.addArguments("--safebrowsing-disable-extension-blacklist");

should do the job.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • Unfortunately, it doesn't work. I have a feeling that --safebrowsing-disable-download-protection and --safebrowsing-disable-extension-blacklist have been deprecated for quite a while. – Fedor Gabrus Jan 10 '22 at 12:59