Internet Explorer is dead! Long live IE Mode. Selenium no longer supports the standalone browser, but it does support executing Microsoft Edge in IE Mode. I wrote C++ code (for the first time!) to make using the IEDriverServer in v4.5 easier to use. Plus, there are two common issues I’ll show how to address.


Windows 10

On Windows 10, you likely have both IE and Edge browsers installed.

Standalone IE

So long as you’ve set your zoom level to 100% and made all of the protected mode settings the same, no additional custom options are needed to run tests with the standalone Internet Explorer.

IE Mode (old)

To use Edge in IE Mode, prior to IEDriverServer v4.5, you need to set 2 separate options: ie.edgechromium and ie.edgepath (the method names on the IE Options classes vary significantly between the languages). The first issue with IE Mode is that the Zoom Level of IE Mode is different from the Zoom Level of standalone Internet Explorer. I have not found a way to change the IE Mode zoom level, which means you have to set the option for ignoreZoomSetting, which, again, has different method names in the different languages. With this option set, though, IEDriver can not properly parse the coordinates on a screen. That means that the various Mouse and Scroll Wheel methods in the Actions class that require using coordinates will not work in IE Mode.

Also note that you can’t have uninstalled Internet Explorer if you want to use Edge in IE Mode (yes, I tried it).

  • InternetExplorerOptions options = new InternetExplorerOptions();
    options.ignoreZoomSettings();
    options.attachToEdgeChrome();
    options.withEdgeExecutablePath(System.getenv("EDGE_PATH"));
    driver = new InternetExplorerDriver(options);
    
  • options = Selenium::WebDriver::Options.internet_explorer(ignore_zoom_level: true,
                                                             attach_to_edge_chrome: true,
                                                             edge_executable_path: ENV['EDGE_PATH'])
    driver = Selenium::WebDriver.for :ie, options: options
    
  • options = InternetExplorerOptions()
    options.ignore_zoom_level = True
    options.attach_to_edge_chrome = True
    options.edge_executable_path = os.getenv("EDGE_PATH")
    driver = webdriver.Ie(options=options, service=service)
    
  • var options = new InternetExplorerOptions
    {
        IgnoreZoomLevel = true,
        AttachToEdgeChrome = true,
        EdgeExecutablePath = Environment.GetEnvironmentVariable("EDGE_PATH")
    };
    var driver = new InternetExplorerDriver(options);
    

IE Mode (new)

As of IEDriverServer v4.5, you no longer need to specify the location of Edge; the driver will automatically locate the default browser for you if you’ve specified to use Edge.

  • InternetExplorerOptions options = new InternetExplorerOptions();
    options.ignoreZoomSettings();
    options.attachToEdgeChrome();
    driver = new InternetExplorerDriver(options);
    
  • options = Selenium::WebDriver::Options.internet_explorer(ignore_zoom_level: true,
                                                             attach_to_edge_chrome: true)
    driver = Selenium::WebDriver.for :ie, options: options
    
  • options = InternetExplorerOptions()
    options.ignore_zoom_level = True
    options.attach_to_edge_chrome = True
    driver = webdriver.Ie(options=options, service=service)
    
  • var options = new InternetExplorerOptions
    {
        IgnoreZoomLevel = true,
        AttachToEdgeChrome = true
    };
    var driver = new InternetExplorerDriver(options);
    

Windows 11

Windows 11 won’t even have IE installed. Needing to specify for the Driver to use Edge is redundant since it’s the only option available, so as of IEDriverServer v4.5 it is no longer necessary.

IE Mode has the same issue on Windows 11 as on Windows 10, the Zoom Level can not be changed by the user, so ignoreZoomSetting must still be set. The other major with IE Mode is specific to Windows 11 because when Microsoft removed the Internet Explorer UI, they also removed the ability to change the Protected Mode settings for the different network zones. Moving between zones can cause security problems, so the driver doesn’t allow it. If you are one of the many people who already sets the ignoreProtectedModeSettings parameter to ignore this problem, just know that you’re doing it wrong. (Un?)fortunately, all that flag is doing is telling the driver to ignore registry values, and those values do not even exist by default in Windows 11, so using it here also won’t help us.

IE Driver always opens to a start page on localhost, typically http://localhost:5555/, which is in the local intranet zone. Most people want to navigate to a page in the internet zone, and Edge is hanging after doing this initial navigation. There are two options for solving this problem.

  • The quick and easy, and possibly “good enough” solution is to set the initialBrowserUrl option. For some reason, if you specify a URL in the internet zone, it will get the browser past the part where it would otherwise hang.

  • The more thorough — and better — solution is to edit the registry to set the required values directly. Open the Registry Editor and navigate to HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\0. You want to add a DWORD with key 2500 and set value 3. Add this on zones 1, 2, 3, and 4 as well. Note that a value of 0 enables protected mode and a value of 3 disables it. It doesn’t matter which you choose, so long as all 5 zones are set to the same value. (I’ll be uploading a video soon to walk you through this)

This is what the new code looks like ignoring the zoom level and setting an initial URL:

  • InternetExplorerOptions options = new InternetExplorerOptions();
    options.ignoreZoomSettings();
    options.withInitialBrowserUrl("https://selenium.dev")
    driver = new InternetExplorerDriver(options);
    
  • options = Selenium::WebDriver::Options.internet_explorer(ignore_zoom_level: true,
                                                             initial_browser_url: 'https://selenium.dev')
    driver = Selenium::WebDriver.for :ie, options: options
    
  • options = InternetExplorerOptions()
    options.ignore_zoom_level = True
    options.initial_browser_url = 'https://selenium.dev'
    driver = webdriver.Ie(options=options)
    
  • var options = new InternetExplorerOptions
    {
        IgnoreZoomLevel = true,
        InitialBrowserUrl = "https://selenium.dev"
    };
    var driver = new InternetExplorerDriver(options);
    

Microsoft is promising to support IE Mode until 2029, so there will be plenty of time to fix these and/or find new issues. There is a tracker of known issues. If you have an issue with IE Mode, create a Selenium bug report, and we’ll coordinate with the Microsoft Edge team and look into it.


Follow me if you found this article interesting,
or answer one of these questions in the comments or on Twitter: