ScreenshotNeo

BlogHow-to

How to Make Playwright Use an Installed Browser

Launch installed Chrome or Edge with Playwright using channels, executable paths, and reliable CI settings.

By the ScreenshotNeo team1 October 20266 min read

Playwright can use an installed Google Chrome or Microsoft Edge. In Node.js, pass a branded browser channel to chromium.launch():

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

(async () => {
  const browser = await chromium.launch({
    channel: 'chrome', // or 'msedge'
    headless: true
  });
  const page = await browser.newPage();
  await page.goto('https://example.com');
  console.log(await page.title());
  await browser.close();
})();

Use channel: 'chrome' or channel: 'msedge' when the branded browser is installed for the same user or service account running Playwright. Playwright supports branded channels such as chrome, chrome-beta, chrome-dev, chrome-canary, msedge, msedge-beta, msedge-dev, and msedge-canary. Branded browsers are not installed by Playwright by default. See the Playwright browser documentation and the launch API reference.

1. Choose the right launch method

Method Use it when Trade-off
Playwright-managed Chromium CI, tests, and repeatable builds May differ from users’ branded browser
channel: 'chrome' or 'msedge' You need branded-browser behavior The browser must already be installed; enterprise policy can affect launch
executablePath A nonstandard or controlled binary must be selected Playwright warns about compatibility and puts the choice at your risk

2. Install Playwright and select Chrome or Edge

Node.js setup

mkdir playwright-installed-browser
cd playwright-installed-browser
npm init -y
npm install playwright

Then create capture.js:

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

const channel = process.env.BROWSER_CHANNEL || 'chrome';

(async () => {
  const browser = await chromium.launch({ channel, headless: true });
  const page = await browser.newPage({ viewport: { width: 1440, height: 900 } });
  await page.goto('https://example.com', { waitUntil: 'networkidle' });
  await page.screenshot({ path: 'example.png', fullPage: true });
  await browser.close();
})();
node capture.js
BROWSER_CHANNEL=msedge node capture.js

The import remains chromium for Chrome and Edge. The channel selects the executable; changing the import is not required.

Supported channel names

chrome
chrome-beta
chrome-dev
chrome-canary
msedge
msedge-beta
msedge-dev
msedge-canary

Use the exact documented value. A channel name does not install the browser or search arbitrary folders.

3. Use an explicit executable path

When a channel cannot find the installation, pass an absolute path:

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

(async () => {
  const browser = await chromium.launch({
    executablePath: '/absolute/path/to/chrome-or-chromium',
    headless: true
  });
  const page = await browser.newPage();
  await page.goto('https://example.com');
  await page.screenshot({ path: 'shot.png' });
  await browser.close();
})();

On Windows, escape backslashes:

const browser = await chromium.launch({
  executablePath: 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe',
  headless: true
});

Playwright resolves a relative path against the current working directory. Prefer an absolute path so a different working directory cannot select the wrong binary. The API reference advises using executablePath “with extreme caution”: Playwright is tested with its bundled Chromium, Firefox, and WebKit builds, while a custom executable may be incompatible.

Finding the path

Use the operating system’s normal browser installation location or your deployment configuration. Verify that the Playwright process can read and execute the file, and record the browser version alongside the Playwright package version.

4. Python Playwright

Python uses the same channel and executable-path concepts.

python -m pip install playwright
python -m playwright install
from playwright.sync_api import sync_playwright

with sync_playwright() as p:
    browser = p.chromium.launch(channel="chrome", headless=True)
    page = browser.new_page(viewport={"width": 1440, "height": 900})
    page.goto("https://example.com", wait_until="networkidle")
    page.screenshot(path="example.png", full_page=True)
    browser.close()

For an explicit binary:

from playwright.sync_api import sync_playwright

with sync_playwright() as p:
    browser = p.chromium.launch(
        executable_path="/absolute/path/to/chrome-or-chromium",
        headless=True,
    )
    page = browser.new_page()
    page.goto("https://example.com")
    page.screenshot(path="shot.png")
    browser.close()

5. Prefer the bundled browser for reproducible CI

Each Playwright release expects specific browser versions. Install the matching Chromium build:

npx playwright install chromium

On Linux, install required operating-system dependencies where permitted:

npx playwright install --with-deps chromium

The general command installs Playwright’s default supported browsers:

npx playwright install

Use a branded channel when fidelity to desktop Chrome or Edge matters. Use the managed browser when repeatability matters more than matching a separately updated desktop installation.

6. Share or isolate Playwright browser binaries

Set PLAYWRIGHT_BROWSERS_PATH during both installation and execution to share a cache between jobs:

PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers npx playwright install chromium
PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers npx playwright test

For a hermetic project-local install:

PLAYWRIGHT_BROWSERS_PATH=0 npx playwright install chromium

This variable controls Playwright-managed browsers. It does not move an existing Google Chrome or Microsoft Edge installation, and it does not change how a branded channel locates that installation.

7. Headless, headed, and browser context options

headless: true is suitable for servers and CI. Set headless: false while diagnosing launch or profile issues. Keep browser processes short-lived in scripts, but reuse one browser across many pages when processing a batch.

const browser = await chromium.launch({ channel: 'chrome', headless: false });
const context = await browser.newContext({
  viewport: { width: 1280, height: 800 },
  locale: 'en-US',
  timezoneId: 'UTC'
});
const page = await context.newPage();

Do not point automation at a profile that is simultaneously open in a normal Chrome session. Use a separate context or a temporary user-data directory when you need persistent state.

8. Troubleshooting

Symptom Cause Fix
Executable doesn’t exist The channel’s browser is not installed for this account Install Chrome or Edge, use the correct channel, or provide an absolute executablePath.
Unknown browser channel A typo or unsupported channel value Use one of the documented Chrome or Edge channel names.
Works locally, fails in CI CI runs as another user or has no desktop browser Install the browser in the CI image, use Playwright-managed Chromium, or configure the path for the CI account.
Linux launch error about shared libraries System dependencies are missing Run npx playwright install --with-deps chromium where the environment allows it.
Permission denied The process cannot execute the binary Check ownership and execute permissions; verify the path from the same account that runs Playwright.
Unexpected browser behavior Custom executable version is incompatible with the Playwright package Pin Playwright, record the browser version, and run the exact combination in CI before depending on it.
Relative path selects the wrong file The working directory changed Use an absolute path.
Profile is locked Another Chrome process is using the same profile Close the interactive browser or use an isolated profile/context.

9. Performance, reliability, and cost

  • Launching a browser is expensive compared with opening a page. Reuse one browser process and create separate contexts for multiple jobs.
  • Use waitUntil: 'domcontentloaded' when you do not need every network request to finish; use networkidle only when the page’s network behavior makes it appropriate.
  • Cache Playwright-managed browser binaries with PLAYWRIGHT_BROWSERS_PATH in CI to avoid repeated downloads.
  • Branded browsers update independently. Pin your Playwright dependency and validate browser updates before rolling them into production.
  • Installed-browser automation has no separate Playwright usage fee; your costs are the machine, CI minutes, storage, and network traffic. A screenshot API can shift browser maintenance and execution to a service.

10. Or skip the browser setup

If your goal is a reliable screenshot rather than managing a local browser, ScreenshotNeo provides a website screenshot API. One GET request returns PNG, JPEG, WebP, or PDF. It removes cookie and consent banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, timeouts, failed loads, and cache hits are not billed.

cURL:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Python:

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)

Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

See the ScreenshotNeo API documentation for options such as full-page capture, CSS selectors, device presets, custom CSS and JavaScript, waits, request blocking, headers, cookies, geolocation, PDF output, caching, signed links, webhooks, bulk capture, and usage data. An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.

11. FAQ

Does Playwright download Chrome when I use channel: 'chrome'?

No. The branded browser must already be installed. Playwright’s install commands manage Playwright-supported browser binaries separately.

Can I use Edge with the Chromium import?

Yes. Use chromium.launch({ channel: 'msedge' }).

Should I use channel or executablePath?

Use a channel for a standard installed Chrome or Edge build. Use executablePath only when you control a nonstandard location or binary and can validate compatibility.

Does PLAYWRIGHT_BROWSERS_PATH change Chrome’s installation directory?

No. It changes storage and lookup for Playwright-managed browsers only.

What is the safest option for deterministic tests?

Install the browser version associated with your Playwright package and use the same installation in every CI job.