Use Playwright to automate and test in Microsoft Edge

Playwright is a Node.js library to automate Chromium, Firefox, and WebKit with a single API. Playwright is built to enable cross-browser web automation that is ever-green, capable, reliable, and fast. Since Microsoft Edge is built on the open-source Chromium web platform, Playwright is also able to automate Microsoft Edge.

Playwright launches headless browsers by default. Headless browsers do not display a UI, so instead you must use the command line. You may also configure Playwright to run full (non-headless) Microsoft Edge as well.

By default, when you install Playwright, the installer downloads Chromium, Firefox, and WebKit. If you have Microsoft Edge (Chromium) installed as well, Playwright just needs a one-line code change to test your website or app in Microsoft Edge. To download Microsoft Edge (Chromium), navigate to Download Microsoft Edge.

Installing Playwright

Install Playwright to test your website or app with the following command.

npm i playwright

Launch Microsoft Edge with Playwright


Playwright requires Node.js version 10.17 or above. Run node -v from the command line to ensure you have a compatible version of Node.js. The browser binaries for Chromium, Firefox and WebKit work across Windows, macOS, and Linux. For more information, navigate to Playwright System Requirements.

Playwright should be familiar to users of other browser-testing frameworks like WebDriver or Puppeteer. You create an instance of the browser, open a page, and then manipulate it with the Playwright API. In the following code snippet, Playwright launches Microsoft Edge (Chromium), navigates to, and saves a screenshot as example.png.

Copy the following code snippet and save it as example.js.

const { chromium } = require('playwright');

(async () => {
  const browser = await chromium.launch({
    executablePath: 'C:\\Program Files (x86)\\Microsoft\\Edge Dev\\Application\\msedge.exe'
  const page = await browser.newPage();
  await page.goto('');
  await page.screenshot({path: 'example.png'});

  await browser.close();

Change executablePath to point to your installation of Microsoft Edge (Chromium). For example, on macOS, the executablePath for Microsoft Edge Canary should be set to /Applications/Microsoft\ Edge\ To find the executablePath, navigate to edge://version and copy the Executable path on that page or install the edge-paths package with the following command.

npm i edge-paths

The following code snippet uses the edge-paths package to programmatically find the path to your installation of Microsoft Edge (Chromium) on your OS.

const edgePaths = require("edge-paths");

const EDGE_PATH = edgePaths.getEdgePath();

Finally, set executablePath: EDGE_PATH in example.js. Save your changes.


Microsoft Edge (EdgeHTML) does not work with Playwright. You must install Microsoft Edge (Chromium) to continue following this example.

Now run example.js from the command line.

node example.js

Playwright launches Microsoft Edge, navigates to, and saves a screenshot of the page. You may customize the page size with page.setViewportSize().

The example.png file produced by example.js

example.js is just a simple demonstration of the automation and testing scenarios enabled by Playwright. To take screenshots in multiple web browsers, change the following code.

  • Chromium await chromium.launch()
  • Firefox await firefox.launch()
  • WebKit await webkit.launch()

For more information about Playwright, navigate to the Playwright website. Check out the Playwright repo on GitHub. To share your feedback on automating and testing your website or app with Playwright, file an issue.