Elchin Iusubov
Elchin Iusubov

Reputation: 11

How can I switch off Microsoft Defender SmartScreen using selenium-webdriver to avoid errors when downloading xml files?

I'm using Edge for automated tests with selenium-webdriver. I have faced an issue which prevents downloading of xml files. Error message

Do you have any ideas how can I switch off Microsoft Defender SmartScreen when starting Edge browser? For chrome browser it can be done by setting option prefs.put("safebrowsing.enabled", false);. Is there anything similar for Edge?

Upvotes: 1

Views: 716

Answers (1)

Yu Zhou
Yu Zhou

Reputation: 12961

The error message pop up is not controlled by Microsoft Defender SmartScreen so there's no use to switch it off.

I know that you want to control it with Selenium but there's no Edge option that can override the warning in Selenium. The solutions in other threads are for old versions of browsers. safe browsing is now the default behavior so it won't work either. 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 first, then use Selenium to automate. For more information, you can also refer to this thread. In the accepted answer of the thread, it uses PowerShell script to update Windows Registry to set the group policy, you can also use it as a workaround.

Upvotes: 0

Related Questions