'How to handle "This type of file can harm your device" alert when clicking download when browser preferences aren't working in c# selenium automation?
I'm automating a web tool in which I have to download a file. I've added all the necessary preferences for the browser version and still the same prompt is shown. I'm using webdriver for chrome version 100.0.4896.127. The code that I used is this: ChromeOptions rm_chromeoptions = new ChromeOptions();
rm_chromeoptions.AddUserProfilePreference("safebrowsing_for_trusted_sources_enabled", true);
rm_chromeoptions.AddUserProfilePreference("download.default_directory", @"C:\Users\Downloads");
rm_chromeoptions.AddUserProfilePreference("download.directory_upgrade", true);
rm_chromeoptions.AddUserProfilePreference("download.prompt_for_download", false);
rm_chromeoptions.AddArgument("download.extensions_to_open");
rm_chromeoptions.AddArgument("--safebrowsing-disable-download-protection");
rm_chromeoptions.AddArgument("safebrowsing-disable-extension-blacklist");
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
