Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I roll to a specific browser version with Playwright?

I need to run some tests using Playwright among different Chromium versions. I have different Chromium folders with different versions, but I don't know how to switch from a version to another using the CLI to run my tests. Some help? Thanks :)

like image 287
Ciccios_1518 Avatar asked Sep 13 '25 13:09

Ciccios_1518


1 Answers

You can use the executablePath argument when launching the browser to use a custom executable. See here. Note, that this only works with Chromium based browsers, see here.

const playwright = require('playwright');

(async () => {
  const browser = await playwright.chromium.launch({
    executablePath: '/your/custom/chromium', 
    headless: false, // to see the browser
    slowMo: 4000 // to slow it down
  });
  // example for edge on msft windows 
  // executablePath: 'C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe',


  const page = await browser.newPage();
  await page.goto('http://whatsmyuseragent.org/');
  await page.screenshot({ path: `example.png` });
  await browser.close();
})();

Also Playwright does only test against the latest stable version, so other Chromium versions might miss-behave. See here under the releases.

like image 71
Max Schmitt Avatar answered Sep 15 '25 07:09

Max Schmitt