Run Web Automation Tests at Scale with Agentic AI

Generate tests with AI agents or automate test suites with Selenium, Playwright and other frameworks. Run tests in parallel on TestMu AI scalable cloud grid.

Selenium TutorialAutomationTutorial

Selenium Automation Testing on Microsoft Edge and IE Mode

Run Selenium 4 tests on Microsoft Edge with EdgeOptions on Windows and macOS, handle IE mode pages, and scale Edge runs on a cloud grid.

Last Updated on:

Microsoft Edge ships with Windows and runs on macOS, so it belongs in most Selenium browser matrices. Microsoft's Edge WebDriver documentation states that Edge automation requires Selenium 4, because Selenium 3 is no longer supported.

This article covers a first Edge test, the EdgeOptions you will use most, Edge on macOS, legacy IE pages, and running the same test on TestMu AI. For downloading and installing the driver by hand, see the Edge Driver setup guide.

TL;DR

Selenium automation testing on Microsoft Edge needs Selenium 4 and Microsoft Edge WebDriver (msedgedriver). Selenium Manager downloads the matching driver for you, EdgeOptions handles headless runs and browser channels, and the same script runs on Windows and macOS.

  • Selenium Manager: Selenium Manager ships with every Selenium release since 4.6 and downloads the msedgedriver that matches your installed Edge, so a plain webdriver.Edge() call starts a session.
  • Version matching: A manually downloaded msedgedriver must match the first three parts of the Edge version number, for example 128.0.2739.79 with 128.0.2739.84.
  • Headless Edge: Adding the --headless=new argument to EdgeOptions runs Edge without a window, which suits CI agents with no display.
  • IE mode: Pages that need Internet Explorer run in Edge's IE mode through the Selenium IE Driver with attachToEdgeChrome, not through msedgedriver.

Can You Test Edge on macOS Without a Mac?

Yes. The test in this article passed on Edge for macOS Sequoia and Windows 11 on the TestMu AI cloud grid, with no local Edge install on either platform.

How to Set Up Selenium for Microsoft Edge

Install the Selenium 4 bindings for your language, for example pip install selenium or npm install selenium-webdriver. The Selenium Manager documentation says it ships with every Selenium release since 4.6 and discovers, downloads and caches the drivers Selenium needs, msedgedriver included.

Older Edge tutorials use MicrosoftWebDriver.exe for the EdgeHTML engine. Microsoft says that legacy driver is not compatible with Chromium-based Edge and is no longer recommended, so remove it from old projects. If Edge refuses to start under automation on a managed laptop, check the DeveloperToolsAvailability policy: a value of 2 blocks Microsoft Edge WebDriver.

Test across 3000+ browser and OS environments with TestMu AI

How to Write Your First Selenium Test on Edge

The test opens the Simple Form Demo on the Selenium Playground, types a message, clicks Get Checked Value and waits for the message to appear. It waits for document.readyState to reach complete before typing: on our first macOS cloud run, typing straight away timed out because the page's JavaScript had not attached its handlers yet.

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait

driver = webdriver.Edge()  # Selenium Manager finds msedgedriver
try:
    driver.get("https://www.testmuai.com/selenium-playground/simple-form-demo/")
    wait = WebDriverWait(driver, 20)
    wait.until(lambda d: d.execute_script("return document.readyState") == "complete")
    driver.find_element(By.ID, "user-message").send_keys("Hello from Edge")
    driver.find_element(By.ID, "showInput").click()
    wait.until(EC.text_to_be_present_in_element((By.ID, "message"), "Hello from Edge"))
    print("message:", driver.find_element(By.ID, "message").text)
finally:
    driver.quit()

The JavaScript version below is the script we ran locally on Windows 11 with Edge 155. All three local runs passed; the first took 14.2 seconds because Selenium Manager downloaded msedgedriver, and the next two took 4.9 and 3.1 seconds.

const { Builder, By, until } = require('selenium-webdriver');
const edge = require('selenium-webdriver/edge');

(async () => {
  const options = new edge.Options().addArguments('--headless=new');
  const driver = await new Builder().forBrowser('MicrosoftEdge').setEdgeOptions(options).build();
  try {
    await driver.get('https://www.testmuai.com/selenium-playground/simple-form-demo/');
    await driver.wait(async () => (await driver.executeScript('return document.readyState')) === 'complete', 20000);
    const field = await driver.wait(until.elementLocated(By.id('user-message')), 20000);
    await field.sendKeys('Hello from Edge');
    await driver.findElement(By.id('showInput')).click();
    const message = await driver.findElement(By.id('message'));
    await driver.wait(until.elementTextIs(message, 'Hello from Edge'), 10000);
    console.log('message:', await message.getText());
  } finally {
    await driver.quit();
  }
})();

How to Configure EdgeOptions

EdgeOptions passes arguments and a browser binary to Edge. Use --headless=new on CI agents, and binary_location to test a preview channel such as Edge Beta before it reaches your users.

options = webdriver.EdgeOptions()
options.add_argument("--headless=new")
options.add_argument("--window-size=1920,1080")
options.binary_location = "C:/Program Files (x86)/Microsoft/Edge Beta/Application/msedge.exe"
driver = webdriver.Edge(options=options)

How to Test Microsoft Edge on macOS

Edge on macOS uses the same Selenium code as on Windows; Selenium Manager fetches the macOS build of msedgedriver. Our run of the test above on TestMu AI used Edge 155 on macOS Sequoia and passed in 13.1 seconds. Internet Explorer itself never ran on macOS; for that history and its workarounds, see testing Internet Explorer on a Mac.

Selenium Playground Simple Form Demo on Microsoft Edge for macOS showing the typed message echoed in the Your Message panel

How to Test Internet Explorer Pages in Edge

msedgedriver cannot render a page in IE mode. Legacy pages that need Internet Explorer run through the Selenium IE Driver with the attachToEdgeChrome option, which opens Edge and loads the page with the IE 11 engine. The Selenium IE Driver guide covers that setup and its limits.

Note

Note: Run Edge, IE mode and 3,000+ other browser and OS combinations without maintaining Windows or Mac machines. Try TestMu AI free

How to Run Edge Tests on a Cloud Grid

TestMu AI's Automation Cloud runs Selenium on 3,000+ browser and OS combinations and records network logs, console logs, video and screenshots for every session. Swap the local builder for these capabilities; the same test passed on Edge for Windows 11 in 16.9 seconds and on macOS Sequoia in 13.1 seconds.

const caps = {
  browserName: 'MicrosoftEdge',
  browserVersion: 'latest',
  platformName: 'Windows 11', // or 'macOS Sequoia'
  'LT:Options': {
    username: process.env.LT_USERNAME,
    accessKey: process.env.LT_ACCESS_KEY,
    build: 'Selenium Edge and IE Mode Blog',
    w3c: true
  }
};
const driver = await new Builder()
  .usingServer('https://hub.lambdatest.com/wd/hub')
  .withCapabilities(caps)
  .build();
Run tests up to 70% faster on the TestMu AI cloud grid

Conclusion

Run the Python test above against your own login page on local Edge, then add Edge on Windows 11 and macOS to your CI matrix with the capabilities from TestMu AI's Selenium capabilities documentation.

Testing from the terminal? Kane CLI by TestMu AI lets SDETs and developers plan, write, run and debug tests from the command line.

To run your first test, start free, or
for a full walkthrough of the product.

Author

...

Himanshu Sheth

Blogs: 153

  • Twitter
  • Linkedin

Himanshu Sheth is the Director of Marketing (Technical Content) at TestMu AI, with over 8 years of hands-on experience in Selenium, Cypress, and other test automation frameworks. He has authored more than 130 technical blogs for TestMu AI, covering software testing, automation strategy, and CI/CD. At TestMu AI, he leads the technical content efforts across blogs, YouTube, and social media, while closely collaborating with contributors to enhance content quality and product feedback loops. He has done his graduation with a B.E. in Computer Engineering from Mumbai University. Before TestMu AI, Himanshu led engineering teams in embedded software domains at companies like Samsung Research, Motorola, and NXP Semiconductors. He is a core member of DZone and has been a speaker at several unconferences focused on technical writing and software quality.

Reviewer

...

Navin Chandra

Reviewer

  • Linkedin

Navin Chandra is a Member of Technical Staff at TestMu AI, building the open-source automation that powers its Selenium and Appium cloud grid. A committer to both Selenium and Appium, he implemented WebDriver BiDi support in Selenium for real-time browser events and bidirectional control and is developing Apple's iOS RemoteXPC protocol in Appium to enable low-level wireless communication with iOS system services. He contributes to Selenium across multiple language bindings as a member of the Selenium GitHub organization. He has served as a Google Summer of Code mentee and mentor at openSUSE and an LFX mentee at CNCF's KubeArmor, and is a SUSE Certified Deployment Specialist. Navin holds a B.Tech in Computer Science.

Add to Google preferred sources

Summarise with AI

Copied to Clipboard!
...

3000+ Browsers. One Platform.

See exactly how your site performs everywhere.

Try it free
...

Write Tests in Plain English with KaneAI

Create, debug, and evolve tests using natural language.

Try for free

Selenium on Edge FAQs

Did you find this page helpful?

More Related Blogs

TestMu AI forEnterprise

Get access to solutions built on Enterprise
grade security, privacy, & compliance

  • Advanced access controls
  • Advanced data retention rules
  • Advanced Local Testing
  • Premium Support options
  • Early access to beta features
  • Private Slack Channel
  • Unlimited Manual Accessibility DevTools Tests