Selenium with MS Edge Beta (v91) does not download XML files without prompt (this type of file can harm your device)

Viewed 1850

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?

2 Answers

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

Please take a look at https://docs.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": ["*"]}]"

Related