Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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` });
})();
like image 885
Rajesh G Avatar asked Jun 09 '20 11:06

Rajesh G


1 Answers

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.

like image 60
hardkoded Avatar answered Oct 17 '22 21:10

hardkoded