Load and test an unpacked Manifest V3 Chrome extension's popup, options page, and service worker in a Playwright test

domain: playwright.dev · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Launch with chromium.launchPersistentContext(userDataDir, {args: ['--disable-extensions-except=<path>', '--load-extension=<path>']}), since loading an extension requires a persistent profile rather than a plain browser.newContext()
  2. Confirm the extension is Manifest V3 — current Playwright no longer supports loading Manifest V2 unpacked extensions
  3. Use the new headless mode (or the chromium channel) if extension behavior must be verified headlessly, since classic headless Chromium doesn't support extensions by default
  4. Get the extension's service worker via context.waitForEvent('serviceworker') (or context.serviceWorkers() if already running) to read its extension ID and build chrome-extension://<id>/... URLs for testing the popup or options page directly
  5. Expect the MV3 service worker to suspend after a period of inactivity and restart on demand; Playwright keeps the same Worker object reference across that suspend/restart rather than firing a new event

Known gotchas

Related routes

Configure Playwright to run the same tests across multiple browser projects (Chromium, Firefox, WebKit)
playwright.dev · 5 steps · unrated
Handle OAuth popup windows in Playwright by listening for the popup event before triggering the click
playwright.dev · 5 steps · unrated
Open and interact with a Chrome extension background service worker via Puppeteer CDP targets
pptr.dev · 6 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans