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);
For those who think it's a duplicate, the following links are useless with the current driver version:
- How to hide the warning "This type of file can harm your computer" while downloading .xml file using Chrome Chromedriver 79 with Selenium Java
- How to disable 'This type of file can harm your computer' pop up
- Unable to download file using ChromeDriver
- ChromeOption '--safebrowsing-disable-download-protection' doesn't disables the download warning in Chrome version 67.x
- How to disable 'This type of file can harm your computer' pop up
- XML file download blocked in selenium chromedriver
- Download .xml file with selenium chrome driver
- How to use chrome webdriver in selenium to download files in python?