'How to use installed version of chrome in Playwright?

I want to use chrome instead of chromium. I can achieve the same in puppeteer by providing executable path. In playwright it doesn't work as browser type argument supports only 'chromium, webkit, firefox'

const { chromium } = require('playwright');
(async () => {
    const browser = await chromium.launch({
        headless: false,
        executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
    });
    const context = await browser.newContext();
    const page = await context.newPage();
    await page.goto('http://whatsmyuseragent.org/');
    await page.screenshot({ path: `example-${browserType}.png` });
})();


Solution 1:[1]

You need to pick one of those flavors. But once you pick the browser type Chromium, you will still be able to pass an executablePath to the launch function.

Solution 2:[2]

In 1.19 you can use chrome.

browser = playwright.chromium.launch(channel="chrome")

or you can simply put it in your playwright configuration file like:

////
    use: {
        headless: true,
        viewport: { width: 1600, height: 1000},
        ignoreHTTPSErrors: true,
        trace: 'on',
        screenshot: 'on',
        channel: "chrome",
        video: 'on'
    },
    ////

More on https://playwright.dev/python/docs/browsers

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Boris Verkhovskiy
Solution 2 Gaj Julije