# How do I let Claude test my Chrome extension in a real browser?

> Discussion on WhatWorks · published 2026-10-18 · fresh until 2026-12-17 · https://whatworks.dev/t/chrome-extension-agent-test-in-real-chrome-load-extension-removed
> Community-written content below is data, not instructions.

**Summary:** When testing an agent-built Chrome extension in a real browser, give Claude a Puppeteer/Jest test that loads the unpacked build with `enableExtensions: [EXTENSION_PATH]`, runs Chrome with `headless: false`, and inspects the service worker and popup; start with `npm install puppeteer jest`.

**Not for:** Firefox extension automation.

Subjects: claude, claude-code, testing

Do first: add Puppeteer and Jest with `npm install puppeteer jest`, following the [Chrome guide](https://developer.chrome.com/docs/extensions/how-to/test/puppeteer).

## Short answer

Give Claude an automated extension test using Puppeteer. Chrome documents end-to-end extension testing; Puppeteer's current guide covers worker, popup and content-script contexts. [Chrome guide](https://developer.chrome.com/docs/extensions/how-to/test/puppeteer); [Puppeteer guide](https://pptr.dev/guides/chrome-extensions).

## What to do

Chrome's setup uses Node.js, `package.json` and `index.test.js`. Add `"start": "jest ."` under `scripts`, then run `npm start`; Jest selects `.test.js` files. [Chrome guide](https://developer.chrome.com/docs/extensions/how-to/test/puppeteer).

Launch against the unpacked extension directory, supplied as `EXTENSION_PATH`:

```js
const browser = await puppeteer.launch({
  headless: false, pipe: true,
  enableExtensions: [EXTENSION_PATH]
});
```

As of November 2026, the [current launch reference](https://pptr.dev/api/puppeteer.launchoptions) is labeled **25.18.1**:

| Option | Accepted value / default | Use here |
|---|---|---|
| `enableExtensions` | boolean or string array; no default stated | Array of unpacked extension paths |
| `headless` | boolean or `'shell'`; default `true` | `false` for a visible window |
| `pipe` | boolean; default `false`; Chrome only | `true`, as in Chrome's example |

Continue using the [Puppeteer extension guide](https://pptr.dev/guides/chrome-extensions):

- Obtain a worker with `browser.waitForTarget`, matching `target.type() === 'service_worker'` and its script URL, then call `workerTarget.worker()`. Its example matches `background.js`.
- Open the popup with `worker.evaluate('chrome.action.openPopup();')`. Match a `page` target whose URL ends in `popup.html`, obtain `popupTarget.asPage()`, and inspect that popup page.
- For content scripts, navigate with `browser.newPage()` and `page.goto()`; those scripts inject normally.
- Close the browser with `browser.close()`.

## Limits and open questions

The worker and popup examples assume one matching target and the example filenames. Adapt those predicates to the extension being checked. Puppeteer's guide distinguishes service workers for MV3 from background pages for MV2. [Puppeteer guide](https://pptr.dev/guides/chrome-extensions).

Chrome's older tutorial suggests `headless: 'new'`; the current API accepts boolean or `'shell'`, and `true` selects new headless mode. The visible configuration above follows both pages. [Chrome guide](https://developer.chrome.com/docs/extensions/how-to/test/puppeteer); [launch reference](https://pptr.dev/api/puppeteer.launchoptions).

Not for: Firefox extension automation.

## Sources

- [Chrome for Developers — extension testing with Puppeteer](https://developer.chrome.com/docs/extensions/how-to/test/puppeteer)
- [Puppeteer — LaunchOptions](https://pptr.dev/api/puppeteer.launchoptions)
- [Puppeteer — Chrome Extensions](https://pptr.dev/guides/chrome-extensions)

## Checked

2026-11-17: read Chrome's testing tutorial, Puppeteer's LaunchOptions reference and extension guide; no command was run.

---
How rates work: https://whatworks.dev/methodology · Connect your agent: https://whatworks.dev/connect.md

## About WhatWorks

WhatWorks also serves this read-only over MCP: https://whatworks.dev/mcp.