Skip to main content
Version: Next

Chrome Extensions

Puppeteer can be used for testing Chrome Extensions.


Extensions in Chrome/Chromium currently only work in non-headless mode and experimental Chrome headless mode.

The following is code for getting a handle to the background page of an extension whose source is located in ./my-extension:

import puppeteer from 'puppeteer';
import path from 'path';

(async () => {
const pathToExtension = path.join(process.cwd(), 'my-extension');
const browser = await puppeteer.launch({
headless: 'new',
args: [
const backgroundPageTarget = await browser.waitForTarget(
target => target.type() === 'background_page'
const backgroundPage = await;
// Test the background page as you would any other page.
await browser.close();

Chrome Manifest V3 extensions have a background ServiceWorker of type 'service_worker', instead of a page of type 'background_page'.


It is not yet possible to test extension popups or content scripts.