Unexpected error launching Internet Explorer. Protected Mode must be set to the same value

When we try to launch IE using WebDriver on very first time on a fresh computer by using this code

WebDriver driver = new InternetExplorerDriver();
driver.get("http://abodeqa.com");

 

Then we filled with amazement when we find this exception

org.openqa.selenium.WebDriverException: Unexpected error launching Internet Explorer. Protected Mode must be set to the same value (enabled or disabled) for all zones. (WARNING: The server did not provide any stacktrace information)
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.6.0_25'
Driver info: driver.version: InternetExplorerDriver
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:131)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:105)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:409)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:103)
    at org.openqa.selenium.ie.InternetExplorerDriver.setup(InternetExplorerDriver.java:104)
    at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:61)

On seeing the exception message we normally come to know the root of this exception and after a few minutes of search on Google, we are loaded with two option.

[the_ad_placement id=”incontent”]
Option 1:- by using capabilities

DesiredCapabilities caps = DesiredCapabilities.internetExplorer();
caps.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,true);
WebDriver driver = new InternetExplorerDriver(caps);

Why We use Capability:

When the rewritten IE driver was first introduced, it was decided that it would enforce its required Protected Mode settings, and throw an exception if they were not properly set. Protected Mode settings, like almost all other settings of IE, are stored in the Windows registry and are checked when the browser is instantiated.

But the Indian Idiotic IT department does not give proper rights to change the system setting..(This gives them immense pleasure like they have hired donkey and would keep them busy in finding the bypass of this hack of their non-sense credential hunt..)(:D) So to cope with such problems we need this capability. Because of this bypass the registry check for initializing IE browser.
But this also causes some unwanted thing like

  1. Hangs
  2. Element location not working
  3. clicks not being propagated

Option 2: If you have rights to change the small setting in your system then try this

Go to Internet Option in IE –> Security–>Check or Unchecked “Enable Protected Mode.” protected-mode-setting

 

Note that you don’t have to change the slider for security level, and you don’t have to disable Protected Mode. I routinely run with Protected Mode turned on for all zones, as I think it provides a more secure browsing experience.

Above solution is inspired/ taken from the work done by Jim Evans. For any kind of IE related issues, you may contact him on his mail id. Hopefully, he would help us at the time of need since he is one of the contributors to the Selenium project, owning the .NET bindings and the Internet Explorer driver.

Dwarika Dhish Mishra

My name is Dwarika Dhish Mishra, its just my name and I am trying to bring the worth of my name in to actions and wants to be the solution not the problem. I believe in spreading knowledge and happiness. More over I am fun loving person and like travelling a lot. By nature I am a tester and a solution maker. I believe in the tag line of http://ted.org “Idea worth spreading” . For the same, I have created this blog to bring more and more learning to tester fraternity through day to day learning in professional and personal life. All contents are the part of my learning and so are available for all..So please spread the contents as much as you can at your end so that it could reach to every needful people in testing fraternity. I am pretty happy that more and more people are showing interest to become the part your Abode QA blog and I think this is good sign for us all because more and more content would be before you to read and to cherish. You may write or call me at my Email id: dwarika1987@gmail.com Cell: 9999978609

You may also like...

4 Responses

  1. Alex says:

    Sorry, got it ! The problem is that one has to click on each of the “zones” and enable that box for each one of them. I didnt realized that mine had one that was unchecked.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.