2

This issue starts to reproduce against MS Edge Chromium Beta v91 (91.0.864.15). This browser was released this Friday, April, 30.

When my Selenium test tried to download an XML file - file did not downloaded. Browser shows warning like "this type of file can harm your device". When I tried to download another file types in the same test (PDF, DOC) - these files downloaded successfully. I.e. my Edge options allows to download file without additional prompt (and it also works correctly in Edge v90). My current Edge Options are:

options.AddUserProfilePreference("download.prompt_for_download", false);
options.AddUserProfilePreference("download.default_directory", "C:\MyDir");
options.AddUserProfilePreference("safebrowsing.enabled", true);  //also tried with 'false' - still not working
options.AddArguments("--safebrowsing-disable-download-protection");
options.AddArguments("safebrowsing-disable-extension-blacklist");

Looks like, Microsoft have added some additional argument into Edge v91 for this. Do you know, what MS Edge option should I use for Edge version 91 to handle XML files download in Selenium tests without prompt?

  • I test many options but there's no one that can override the warning in Selenium. The solutions in other threads are for old versions of browsers, safe browsing is the default behavior now. I think there's not much Selenium can do with the warning. If you want to get rid of the warning when downloading xml files, you can only set this [group policy](https://learn.microsoft.com/en-us/deployedge/microsoft-edge-policies#disable-download-file-type-extension-based-warnings-for-specified-file-types-on-domains) first, then use Selenium to automate. – Yu Zhou May 05 '21 at 07:16

2 Answers2

1

Yeah, looks like it is not possible now to configure it via Edge options. As workaround, I have use the following powershell script, which update Windows Registry:

$regpath="HKLM:\Software\Policies\Microsoft\Edge\ExemptDomainFileTypePairsFromFileTypeDownloadWarnings"

if (!(Test-Path $regpath)) {
    New-Item -Path $regpath -Force
}

New-ItemProperty -Path $regpath -Name "1" -Value '{"domains": ["*"], "file_extension": "xml"}' -PropertyType String -Force
  • 1
    Thanks for posting the solution for this issue. You can mark your answer as an accepted answer. It can help other community members in future in similar kind of issues. Thanks for your understanding. – Yu Zhou May 14 '21 at 01:27
0

Please take a look at https://learn.microsoft.com/en-us/deployedge/microsoft-edge-policies#exemptdomainfiletypepairsfromfiletypedownloadwarnings

"Enterprises can use ExemptDomainFileTypePairsFromFileTypeDownloadWarnings to specify the filetypes that are allowed to download from specific sites without interruption. For instance, the following policy allows XML files to download from contoso.com and woodgrovebank.com without interruption, and MSG files to download from any site.

[{"file_extension":"xml","domains":["contoso.com", "woodgrovebank.com"]}, {"file_extension":"msg", "domains": ["*"]}]"

Devilxpto
  • 1
  • 2