What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Direct answer: In a Chrome extension, bundle Puppeteer’s browser-specific build from puppeteer-core, create or find a tab with the Chrome Tabs API, and connect to that tab with ExtensionTransport.connectTab(tab.id). You can then use ordinary Puppeteer page methods, such as page.evaluate(), inside the extension. This workflow is experimental, limited by chrome.debugger, and each transport connection controls one tab.

“Running Puppeteer in Chrome” can also mean a webpage-hosted client connecting to a separate browser over WebSocket. That is a different architecture: the webpage cannot launch or download Chrome. This guide covers both patterns, shows how to test an extension from Node.js, and explains when each is appropriate.

Choose the hybrid-automation architecture

Pattern Control code runs Connection Browser lifecycle Important limit
Extension-hosted Puppeteer Chrome extension service worker or extension page chrome.debugger through ExtensionTransport.connectTab() Attaches to an existing Chrome tab Experimental; one page per connection
Webpage-hosted Puppeteer Regular webpage WebSocket to a browser debugging endpoint Remote browser must already be running Browser build cannot launch or download Chrome
Node-hosted extension testing Node.js process Normal Puppeteer launch/connect APIs Node launches Chrome with the extension loaded Automates the extension from outside; Puppeteer is not running inside it

The extension route is the right choice when an automation needs Chrome UI context, the user’s authenticated tabs, extension permissions, or a toolbar action. Read the official extension guide for the currently supported details.

What you need before writing code

  • A Chromium-based Chrome installation with an extension you can load unpacked.
  • A Manifest V3 extension (the examples use a service worker).
  • puppeteer-core, not the full puppeteer package, because the extension must use the browser-targeted entry point.
  • A bundler such as Rollup or webpack. Node-oriented dependencies cannot be sent directly to an extension service worker.
  • Permission to use the tabs and debugger APIs. Request the minimum host permissions needed for the pages you automate.

Puppeteer labels extension-hosted use experimental, and the debugger API exposes a restricted subset of Chrome DevTools Protocol (CDP). Treat protocol behavior as release-sensitive. Puppeteer’s documentation is versioned; for example, its 25.12.0 support table maps to Chrome for Testing 154.0.8037.57, but that mapping is not a permanent compatibility promise. Check the current supported-browser table for your installed release.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Build an extension-hosted Puppeteer bundle

1. Install dependencies

npm install puppeteer-core
npm install --save-dev rollup @rollup/plugin-node-resolve

Keep puppeteer-core as a runtime dependency and bundle it into the extension. Do not expect Chrome to resolve npm imports at runtime.

2. Create the Manifest V3 shell

{
  "manifest_version": 3,
  "name": "Hybrid Puppeteer Demo",
  "version": "1.0.0",
  "permissions": ["tabs", "debugger"],
  "host_permissions": ["https://example.com/*"],
  "background": {
    "service_worker": "dist/background.js",
    "type": "module"
  },
  "action": { "default_title": "Run automation" }
}

Use a narrower host pattern than the example in production. The debugger permission is powerful; explain its use clearly to users and avoid attaching to tabs your extension does not need.

3. Bundle the browser entry point

Import the browser-specific file documented by Puppeteer:

import { ExtensionTransport } from 'puppeteer-core/lib/puppeteer/puppeteer-core-browser.js';

export { ExtensionTransport };

A minimal Rollup configuration is:

import { nodeResolve } from '@rollup/plugin-node-resolve';

export default {
  input: 'src/background.js',
  output: {
    file: 'dist/background.js',
    format: 'iife',
    inlineDynamicImports: true
  },
  plugins: [nodeResolve({ browser: true })]
};

The important points are the browser target and resolving only the browser-compatible Puppeteer core. If your bundler emits Node polyfill errors, remove Node-only plugins and verify that the browser entry point is the one being imported.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Connect Puppeteer to a Chrome tab

The connection is deliberately tab-oriented. Find an existing tab or create one with chrome.tabs, pass its numeric ID to ExtensionTransport.connectTab(), then obtain the connected page from browser.pages().

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
import puppeteer from 'puppeteer-core/lib/puppeteer/puppeteer-core-browser.js';
import { ExtensionTransport } from 'puppeteer-core/lib/puppeteer/puppeteer-core-browser.js';

async function tabForAutomation() {
  const [existing] = await chrome.tabs.query({
    url: 'https://example.com/*'
  });

  if (existing?.id !== undefined) return existing;

  return chrome.tabs.create({
    url: 'https://example.com/',
    active: false
  });
}

async function runAutomation() {
  const tab = await tabForAutomation();
  if (tab.id === undefined) throw new Error('Chrome returned a tab without an ID');

  const transport = await ExtensionTransport.connectTab(tab.id);
  const browser = await puppeteer.connect({ transport });

  try {
    const pages = await browser.pages();
    const [page] = pages;
    if (!page) throw new Error('No page was exposed for the connected tab');

    await page.waitForSelector('body');
    const title = await page.title();
    const text = await page.evaluate(() => document.body.innerText);
    console.log({ title, text: text.slice(0, 500) });
  } finally {
    await browser.disconnect();
  }
}

chrome.action.onClicked.addListener(() => {
  runAutomation().catch(console.error);
});

Load the project at chrome://extensions with Developer mode enabled, choose Load unpacked, select the directory containing manifest.json, and click the extension action. Reload the extension after rebuilding the bundle.

Why disconnect matters

browser.disconnect() releases Puppeteer’s client connection without closing Chrome or the user’s tab. The extension should not attempt to use Node’s process, filesystem, or child-process APIs; those do not exist in the extension environment.

Automate more than one tab

An extension transport connection represents one attached tab/page. Puppeteer cannot create additional pages on that same connection. To automate a second tab, create or locate it through chrome.tabs and establish a second transport and Puppeteer connection.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
async function connectToTab(tabId) {
  const transport = await ExtensionTransport.connectTab(tabId);
  const browser = await puppeteer.connect({ transport });
  const [page] = await browser.pages();
  return { browser, page };
}

const tabA = await chrome.tabs.create({ url: 'https://example.com/a' });
const tabB = await chrome.tabs.create({ url: 'https://example.com/b' });
const a = await connectToTab(tabA.id);
const b = await connectToTab(tabB.id);
try {
  await Promise.all([a.page.title(), b.page.title()]);
} finally {
  await Promise.all([a.browser.disconnect(), b.browser.disconnect()]);
}

Coordinate these connections yourself. Opening many debugger attachments can affect the user’s browser and may trigger permission or policy concerns.

Use the webpage browser build when the client is a web app

Puppeteer’s browser guide describes a separate pattern: ship the browser build to a webpage and connect over WebSocket to a browser that already exposes a debugging port. The webpage cannot launch Chrome or download it because those operations depend on Node.js APIs.

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

This fits a control panel where a trusted service starts Chrome and hands the page a short-lived WebSocket endpoint. Protect that endpoint; exposing an unauthenticated debugging port gives remote callers extensive browser control. Use the extension transport instead when the automation must operate directly in the user’s ordinary Chrome session.

Test the extension from Node.js

For end-to-end tests, run Puppeteer in Node and launch Chrome with the extension loaded. This is not the same as running Puppeteer inside the extension; it is an external harness that can exercise the service worker, popup, content scripts, and toolbar action. Puppeteer’s Chrome Extensions guide documents these contexts.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
import puppeteer from 'puppeteer';
import path from 'node:path';

const extensionPath = path.resolve('dist');
const browser = await puppeteer.launch({
  headless: false,
  args: [
    `--disable-extensions-except=${extensionPath}`,
    `--load-extension=${extensionPath}`
  ]
});

const pages = await browser.pages();
const page = pages[0];
// Navigate, click the extension action, and inspect page or service-worker effects.
await page.goto('https://example.com/');
await browser.close();

In Manifest V3, locate the extension service worker through the browser’s targets, open a popup page when the action creates one, and use a content-script execution context when testing DOM code injected into a site. Keep these tests separate from production extension code so Node-only APIs never enter the browser bundle.

Common failures and fixes

“Cannot find module” or Node globals in the extension

Cause: Node’s Puppeteer entry point or an unbundled npm import reached the service worker.

Fix: Import puppeteer-core/lib/puppeteer/puppeteer-core-browser.js, configure a browser-targeted bundler, and inspect the generated bundle for accidental fs, path, or child_process dependencies.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

connectTab is rejected

Cause: The tab ID is missing, the tab is not accessible under your host permissions, or the extension lacks the debugger permission.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Fix: Log the value returned by chrome.tabs.create/query, check tab.id !== undefined, add only the required host pattern, and reload the extension after changing the manifest.

No page appears in browser.pages()

Cause: The tab is still navigating, the attachment failed, or the connected target is not a normal page.

Fix: Wait for the tab’s update event or a known selector, reconnect after navigation if necessary, and confirm that the selected tab is not a restricted Chrome internal URL.

Commands work in Node but not in the extension

Cause: chrome.debugger exposes restricted CDP domains and extension-hosted Puppeteer remains experimental.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Fix: Prefer high-level page methods, check the API reference for ExtensionTransport status, and move unsupported operations to a Node-side worker or a separately controlled browser.

Protocol or launch-version errors

Cause: Puppeteer and Chrome releases are not aligned.

Fix: Consult the Puppeteer FAQ and supported-browser table for the exact package version. Do not treat a version pairing documented for one release as a general guarantee.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Performance, reliability, and security decisions

  • Reuse attachments carefully: reconnecting for every action adds overhead, but keeping a debugger attachment alive longer increases the chance of stale tabs and navigation races.
  • Wait on evidence: prefer waitForSelector or a specific page state over arbitrary delays. A delay can hide slow-network failures.
  • Handle service-worker suspension: Manifest V3 workers can stop when idle. Persist job state in extension storage and make operations restartable.
  • Limit permissions: narrow host permissions, avoid arbitrary user-supplied URLs, and never expose a debugging endpoint to an untrusted network.
  • Separate UI and worker work: use messages between popup/content scripts and the service worker; do not assume a popup remains open for the duration of a long job.

Or skip the browser setup

If your goal is to obtain a clean website screenshot rather than automate a user’s tab, ScreenshotNeo provides a single HTTP request and an MCP server for Claude, Cursor, and other MCP clients. It removes cookie-consent banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, with the result identified by X-Page-Verdict and X-Billed headers.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use the ScreenshotNeo API documentation for all options, including full-page and element capture, device presets, dark mode, custom CSS and JavaScript, waits, request blocking, cookies and headers, PDFs, caching, signed links, asynchronous jobs, bulk capture, and usage reporting.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
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)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

The free plan includes 1,000 screenshots each month with no card. Paid plans start at $5 for 3,000 shots, and every feature is included on every plan. Create a free ScreenshotNeo account.

Further reading

Frequently Asked Questions

Can an extension-hosted Puppeteer connection open a new page?

No. The documented extension transport is limited to the tab it attaches to. Create another Chrome tab and establish another transport connection.

Can a normal website launch Chrome with Puppeteer?

No. The webpage browser build can connect to a browser that is already exposing a WebSocket debugging endpoint, but launching or downloading Chrome requires Node.js.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Is extension-hosted Puppeteer production-ready?

Puppeteer documents the extension environment as experimental and subject to chrome.debugger restrictions. Validate the exact Puppeteer and Chrome versions you deploy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.