Test IE mode in Microsoft Edge with Internet Explorer Driver


  • Staff
In collaboration with our friends in the Selenium project, the Microsoft Edge team is excited to announce that you can now test Internet Explorer mode in Microsoft Edge with Internet Explorer Driver. With just a few changes to an existing test that runs against Internet Explorer, you can get your tests running in Internet Explorer (IE) mode in Edge. By running your tests in IE mode, you will be able to verify that any legacy web content that runs in Internet Explorer will work as expected in IE mode in Microsoft Edge.

Validate IE mode for legacy websites and apps

IE mode is a feature in Microsoft Edge for organizations that still need Internet Explorer 11 for backward compatibility of business-critical legacy websites or apps. To learn more about IE mode, read What is Internet Explorer (IE) mode?.

Starting June 15, 2022, Internet Explorer 11 will no longer be supported on certain versions of Windows 10. For more information, read Internet Explorer 11 desktop app requirement FAQ. We recommend that organizations that still depend on IE11 transition to the Microsoft Edge browser, which supports rendering modern and legacy web content. You can learn more about deploying Microsoft Edge and setting up a Site List in our docs. To prepare for June 15, you can now use Internet Explorer Driver to validate that IE mode is the right solution for your business-critical legacy websites or apps.

What you’ll need to get started

To start running tests in IE mode in Edge, you need the following:

  1. Microsoft Edge
  2. Selenium 4 or later language bindings
  3. Internet Explorer Driver version 4.0.0.0 or later
Once you download IE Driver, ensure that you set it up correctly with Selenium’s Required Configuration.

Code samples

The following C#, Python, Java, and JavaScript code samples assume you are using the Selenium framework but you can use any library, framework, or programming language that supports WebDriver. To accomplish the same tasks using another framework, consult the documentation for your framework of choice.

These code samples launch Microsoft Edge in IE mode, navigate to https://bing.com and runs a search for “IE mode”.

C#

Code:
using System;

using OpenQA.Selenium;

using OpenQA.Selenium.IE;



namespace IEDriverSample

{

class Program

{

staticvoidMain(string[] args)

{

var ieOptions = newInternetExplorerOptions();

            ieOptions.AttachToEdgeChrome = true;

 //change the path accordingly

            ieOptions.EdgeExecutablePath = "C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe";



var driver = newInternetExplorerDriver(ieOptions);

            driver.Url = "https://bing.com";

            driver.FindElement(By.Id("sb_form_q")).SendKeys("IE mode");

            driver.FindElement(By.Id("sb_form")).Submit();



            driver.Quit();

}

}

}

Python

Code:
from selenium import webdriver

from selenium.webdriver.common.by import By

from selenium.webdriver.common.keys import Keys



ie_options = webdriver.IeOptions()

ie_options.attach_to_edge_chrome = True

ie_options.edge_executable_path = "C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"



driver = webdriver.Ie(options=ie_options)



driver.get("http://www.bing.com")

elem = driver.find_element(By.ID, 'sb_form_q')

elem.send_keys('IE mode' + Keys.RETURN)



driver.quit()

Java

Code:
import org.openqa.selenium.By;

import org.openqa.selenium.Keys;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.WebElement;

import org.openqa.selenium.ie.InternetExplorerDriver;

import org.openqa.selenium.ie.InternetExplorerOptions;



publicclass IEDriverSample {

publicstaticvoidmain(String[] args){

        InternetExplorerOptions ieOptions = newInternetExplorerOptions();

        ieOptions.attachToEdgeChrome();

        ieOptions.withEdgeExecutablePath("C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe");



        WebDriver driver = newInternetExplorerDriver(ieOptions);



        driver.get("http://www.bing.com");

        WebElement elem = driver.findElement(By.id("sb_form_q"));

        elem.sendKeys("IE mode", Keys.RETURN);



        driver.close();

}

}

JavaScript

Code:
const{Builder, By, Key, until} = require('selenium-webdriver');

const{Options} = require('selenium-webdriver/ie');



(async()=>{

let ieOptions = newOptions();

  ieOptions.setEdgeChromium(true);

  ieOptions.setEdgePath('C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe');



let driver = awaitnewBuilder().

forBrowser('ie').

setIeOptions(ieOptions).

build();

try{

await driver.get('http://www.bing.com');

let elem = await driver.findElement(By.id('sb_form_q'));

await elem.sendKeys('IE mode', Key.RETURN);

await driver.wait(until.titleIs('IE mode - Bing'), 1000);

}finally{

await driver.quit();

}

})();

For more information on automating IE mode in Edge, head to our docs.

Feedback

If you run into any issues with the code samples, docs, or instructions in this blog post, you can follow up with the Microsoft Edge team on Twitter @EdgeDevTools or by submitting feedback in the Microsoft Edge browser (Alt+Shift+I).

If you are experiencing problems with IE Driver itself or are observing differences between IE Driver version 4.0.0.0 and earlier versions, consult the Known limitations section of our docs. We have included workarounds for some of these known limitations. If you are still blocked, refer to the open issues in the Selenium repo and open a new issue if needed.

Finally, if you are noticing rendering differences between IE mode and the Internet Explorer 11 desktop app, refer to the IE mode troubleshooting and FAQ. If you still need help, you can contact the free App Assure program.

– Zoher Ghadyali, Senior Program Manager, Microsoft Edge


Source:
 

Attachments

  • microsoft_edge_chromium.png
    microsoft_edge_chromium.png
    11.2 KB · Views: 0

Latest Support Threads

Back
Top Bottom