1

Sample Code :

from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

caps = DesiredCapabilities.INTERNETEXPLORER
caps['ignoreProtectedModeSettings'] = True

browser = webdriver.Ie(capabilities=caps)
browser.get('http://www.google.com')

Internet Explorer is not launched and I am facing the below error :

SessionNotCreatedException: Message: Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones. Enable Protected Mode must be set to the same value (enabled or disabled) for all zones.

I can not change the settings in the InternetExplorer. They are controlled by Admin.

I am stuck at this starting point only, can some one help ?

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • Possible duplicate of [Not able to launch IE browser using Selenium2 (Webdriver) with Java](https://stackoverflow.com/questions/14952348/not-able-to-launch-ie-browser-using-selenium2-webdriver-with-java) – Andersson Dec 29 '17 at 10:10
  • Depending on the version of the IE driver you’re using, the capabilities you’re sending across the wire will not work for the driver for ignoring Protected Mode settings. What happens if you use the `selenium.webdriver.ie.Options` class instead of hand-crafting your capabilities? – JimEvans Dec 29 '17 at 22:25

1 Answers1

1

To open InternetExplorer you need to implement the following Configurations :

  1. On IE 7 or higher on Windows Vista or Windows 7, you must set the Protected Mode settings for each zone to be the same value. The value can be on or off, as long as it is the same for every zone. To set the Protected Mode settings, choose "Internet Options..." from the Tools menu, and click on the Security tab. For each zone, there will be a check box at the bottom of the tab labeled "Enable Protected Mode".
  2. Additionally, Enhanced Protected Mode must be disabled for IE 10 and higher. This option is found in the Advanced tab of the Internet Options dialog.
  3. The browser zoom level must be set to 100% so that the native mouse events can be set to the correct coordinates.
  4. For Windows 10, you also need to set Change the size of text, apps, and other items to 100% in display settings.
  5. For IE 11 only, you will need to set a registry entry on the target computer so that the driver can maintain a connection to the instance of Internet Explorer it creates. For 32-bit Windows installations, the key you must examine in the registry editor is HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE. For 64-bit Windows installations, the key is HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE. Please note that the FEATURE_BFCACHE subkey may or may not be present, and should be created if it is not present. Important: Inside this key, create a DWORD value named iexplore.exe with the value of 0.

Now, you have to setup the IEDriverServer binary with the following settings through DesiredCapabilities :

from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

cap = DesiredCapabilities().INTERNETEXPLORER
cap['ignoreProtectedModeSettings'] = True
cap['IntroduceInstabilityByIgnoringProtectedModeSettings'] = True
cap['nativeEvents'] = True
cap['ignoreZoomSetting'] = True
cap['requireWindowFocus'] = True
cap['INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS'] = True
browser = webdriver.Ie(capabilities=cap, executable_path=r'C:\path\to\IEDriverServer.exe')
browser.get('http://google.com/')
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • As my system is controlled by the Admin, i don't have the access to change the protected Mode settings in IE. Is there any possibility to overcome this step with alternate approach ? – Srinivasa Lakkaraju Dec 29 '17 at 10:40
  • My solution includes some code to overcome the issue you are facing with `protected Mode settings`. try the code and lets keep our figures crossed :) – undetected Selenium Dec 29 '17 at 10:50