Selenium: IE Driver does not appear to respect IE-specific desired capabilities

Created on 12 Jul 2018  路  3Comments  路  Source: SeleniumHQ/selenium

Meta -

OS:
Windows Server 2016 Datacenter (AppVeyor Visual Studio 2015 image)
Selenium Version:
3.13.0 (Python)
Browser:
Internet Explorer

Browser Version:
Version: 11.2248.14393.0
Update Versions: 11.0.65

Expected Behavior -

Using desired capabilities such as ignoreProtectedModeSettings should allow the driver to execute without security zone error

Using the initialBrowserUrl should cause the browser to start at the specified URL

Actual Behavior -

These settings are not respected and behave as if they were not set at all.

In the case of ignoreProtectedModeSettings the following error is produced

selenium.common.exceptions.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.

In the case of initialBrowserUrl (when security zones, in fact, all have the same value) the browser opens to http://localhost:9306/ "This is the initial start page for the WebDriver server." page rather than the specified url.

Steps to reproduce -

  1. Configure IE security zones with mismatched disabled/enabled settings
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

caps = DesiredCapabilities.INTERNETEXPLORER
caps['ignoreProtectedModeSettings'] = True
caps['initialBrowserUrl'] = 'about:blank'

driver = webdriver.Ie(capabilities=caps)

That should produce the SessionNotCreatedException error.

  1. reconfigure security zones with same settings and run the above again

The initial url will not be respected.

C-py

All 3 comments

What happens if you use the webdriver.ie.Options class instead of trying to (incorrectly) manage your own capabilities object?

As @jimevans mentioned, try this instead as it puts the options in the correct key within capabilities (which they are not getting into in your version):

from selenium import webdriver

options = webdriver.IeOptions()
options.ignore_protected_mode_settings = True
options.initial_browser_url = 'about:blank'

driver = webdriver.Ie(options=options)

I was able to get my hands on a Windows machine to try this and it's working as intended if you use options and put the capabilities in the correct 'se:ieOptions' key. Closing.

Was this page helpful?
0 / 5 - 0 ratings