Using Puppeteer with Edge Chromium

Power Automate RPA Website Title

The PowerPlatform has frequent updates, leaving users in a situation that testing needs to be able to be fast and reliable, running when deployments are updated. This is so that we can ensure nothing has broken on our customers systems and if there has been issues, we can know about them and resolve them as quick as possible.

If you have been trying to use Selenium to write automation tests but wished you had more control over the browser, especially from the dev tools aspects and you’ve found Selenium, while being great, simply doesnt not cater to your needs for cross-browser testing then look no further. Puppeteer, as shown in this blog post, can now be used for Edge (Canary at the time of writing this) as it is being built from the ground up on the Chromium back-end.

Where to start

Firstly, this is not a post about how to use Puppeteer, this is simply a post explaining how you can utilise the Puppeteer NodeJS framework to run with Edge. I’ll be putting a post up in the coming weeks explaining the benefits of Puppeteer vs Selenium for automation end-to-end tests but for now checkout; Puppeteer vs Selenium

Secondly, if you want to have a look at the full code-base shown in this example then click here: Initial Blog Post Branch. You will need to pre-install:

  • NodeJS LTS
  • Edge Canary
  • IDE to work with TypeScript (VS Code or WebStorm)

Thirdly, the code on GitHub runs a test that opens Edge, then the bing website, enters ‘Microsoft Flow’, searches, gets the official website and opens it.

Working Example

Get Edge Chromium

To do this simply head over to here, download the Canary version and install it.

Set Up The Puppeteer Launcher

If you’re using the code example from GitHub this is src > utils > launchPuppeteer.ts

We need to point Puppeteer to our newly installed Chromium Edge via the Puppeteer options (replace my hard-coded path) and if you want to watch your tests, turn headless off as shown below:

import * as puppeteer from 'puppeteer';
    
const puppeterOptions = {
    headless: false,
    executablePath: 'C:\\Users\\joe\\AppData\\Local\\Microsoft\\Edge SxS\\Application\\msedge.exe',
};
    
export default async () => {
    return await puppeteer.launch(puppeterOptions);
};

That’s as simple as it gets for now. Once you run your tests (which I’ll be showing in later posts how to write), it will now launch Edge and run all of your Puppeteer tests. This allows PowerPlatform users an additional option when approaching automation end-to-end tests, utilising more of the browser, such as connection losses etc.