Enable protected mode must be set to the same value (enabled or disabled) for all zones

I try to use the Selenium Internet Explorer driver, but it breaks when I try to create it:

 [TestInitialize] public void TestInitialise() { ieDriver = new InternetExplorerDriver(); } 

with the following error:

To enable protected mode, it is necessary to set an equal value (on or off) for all zones. (NoSuchDriver).

I found an explicit solution to my problem here , which suggests installing the DesiredCapabilities driver, as shown:

 var capabilitiesInternet = new OpenQA.Selenium.Remote.DesiredCapabilities(); capabilitiesInternet.SetCapability("ignoreProtectedModeSettings", true); IWebDriver webDriver = new InternetExplorerDriver(capabilitiesInternet); 

The only problem is that I am using the latest driver I could find and there is no override for InternetExplorerDriver that takes DesiredCapabilities as a parameter.

Is there any new way to install DesiredCapabilites now instead of the example I used?

+4
source share
3 answers

This option will work around the problem, but introduce some subtle problems. Have you configured IE protected modes correctly? This is the right decision.

The guide to this life is here:

https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver

Essentially, just disable protected mode in IE for each zone.

Alternatively, if you really have to use the override function, then you are either doing two things:

Use the InternetExplorerOptions class. Pay attention to the name of the property, this gives you a big key, and it is not very good to use.

 var options = new InternetExplorerOptions; options.IntroduceInstabilityByIgnoringProtectedModeSettings = true; var driver = new InternetEplorerDriver(options); 

or use RemoteWebDriver, which can accept any implementation of the ICapabilities interface that DesiredCapabilites implements:

 var capabilities = new DesiredCapabilities("internet explorer", string.Empty, new Platform(PlatformType.Windows)); capabilities.SetCapability("ignoreProtectedModeSettings", true); var webDriver = new RemoteWebDriver(capabilities); 
+7
source

This blog post by Jim Evans (Selenium contributor) gives a truly in-depth view of the context surrounding this exception. I will bring it here for posterity:

In IE, from the Tools menu (or the gear icon on the toolbar in later versions), select Internet Options. Click the "Security" tab. At the bottom of the dialog box for each zone, you must select the "Enable Protected Mode" check box. Check the box for the same value, both marked and unchecked, for each zone. Here is the dialog for reference:

Internet Explorer Security Settings Dialog

Please note that you do not need to change the slider for the security level, and you do not need to disable the protected mode. I regularly run with Protected Mode enabled for all zones, as I think it provides a more secure view.

Note. This only worked when the protected mode was turned off.

0
source

This question and answer can also be useful for anyone trying to cope with protected mode issues. I could not get it to work through the Internet Explorer Settings panel, and I had to manually configure the registry.

-1
source

Source: https://habr.com/ru/post/1446048/


All Articles