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.

To use Puppeteer for screenshots in a project Claude Code is helping with, open that project directory and run npm i puppeteer. Puppeteer installs as a project dependency and normally downloads a compatible Chrome for Testing browser. Then create a JavaScript script that launches the browser, opens a page, and calls page.screenshot().

That setup lets Claude Code work with Puppeteer code in your project; it does not, by itself, give Claude Code a browser-control tool. For direct browser interaction from Claude Code, configure a browser automation MCP server separately.

What you are installing—and what Claude Code does

There are two separate pieces: Claude Code, Anthropic’s coding tool, and Puppeteer, a JavaScript library your project uses to automate a browser. Install Puppeteer inside the JavaScript project that needs screenshots. Claude Code can then help create, edit, and run the project script, subject to the tools and permissions available in that environment.

If Claude Code itself needs to interact with a browser through a dedicated tool, a project dependency is not enough. That requires a separate browser automation integration, commonly provided through an MCP server. Anthropic describes adding external MCP servers to Claude Code, and its prompt guidance recognizes browser automation MCP servers as a way for an agent to verify UI work: Claude Code MCP documentation and Claude prompt guidance. Check a server’s current maintainer, installation instructions, configuration, and security model before connecting it.

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

Prepare Claude Code and your project

Anthropic lists Node.js 18 or newer among the requirements for its npm installation of Claude Code. Its setup instructions use npm install -g @anthropic-ai/claude-code, then direct you to enter a project directory and start Claude Code there. Follow Anthropic’s current Claude Code setup guide for the supported installation and sign-in steps.

Do not run the global installation with sudo. Anthropic warns: “Do NOT use sudo npm install -g as this can lead to permission issues and security risks.”

  1. Open a terminal and change to the JavaScript project directory that should own the Puppeteer dependency.
  2. If you have not already set up the project, initialize it with your usual project conventions. Puppeteer should be installed in the project, not as a global package.
  3. Start Claude Code from that directory if you want it to work on the project: run claude after following Anthropic’s setup steps.

Install Puppeteer in the project

For the simplest local setup, install the regular puppeteer package:

npm i puppeteer

The package’s normal installation downloads a compatible Chrome for Testing browser; in applicable releases it may also download a headless shell. Puppeteer stores the browser in its cache by default. Exact browser versions and package-manager behavior can change, so consult the official Puppeteer installation guide if your environment differs or a later installation behaves differently.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sale
HTML and CSS: Design and Build Websites
  • HTML CSS Design and Build Web Sites
  • Comes with secure packaging
  • It can be a gift option

When to use puppeteer-core instead

Use puppeteer-core if you manage the browser yourself, use a remote browser, or need to set a browser executable or channel explicitly. Unlike puppeteer, puppeteer-core does not download Chrome; your code must provide the browser configuration or connection. See the installation guide before choosing this path.

Package Browser setup Best fit
puppeteer Normally downloads a compatible Chrome for Testing browser. A straightforward project setup where Puppeteer should manage its compatible browser.
puppeteer-core Does not download Chrome; configure an executable, channel, or remote browser yourself. An externally managed or remote browser workflow.

Take a screenshot with a project script

Create a file such as screenshot.mjs in the project. This example opens a local development site, sets a viewport, waits for network activity to settle, and writes a full-page PNG:

import puppeteer from 'puppeteer';

const browser = await puppeteer.launch();
try {
  const page = await browser.newPage();
  await page.setViewport({ width: 1280, height: 800 });
  await page.goto('http://localhost:3000', { waitUntil: 'networkidle2' });
  await page.screenshot({ path: 'screenshot.png', fullPage: true });
} finally {
  await browser.close();
}

Run it from the project directory:

node screenshot.mjs

The documented capture method is Page.screenshot(); Puppeteer’s screenshot guide covers its screenshot options. The sample uses http://localhost:3000 as an example: replace it with a page your machine can reach. The viewport dimensions, navigation wait condition, and full-page setting are choices, not universal requirements.

Adjust capture behavior to the page

  • Viewport screenshot: omit fullPage: true to capture the current viewport rather than the full document.
  • Wait condition: networkidle2 is one option for page.goto(). Pages with persistent network requests or delayed content may need a different wait strategy. Do not assume network quiet means every application element is ready.
  • Output: change the screenshot path and format options to fit your workflow; the example writes screenshot.png.
  • Browser cleanup: close the browser in a finally block so it is also closed if navigation or capture throws an error.

The code is a starting point, not a claim that every site will render identically. Authentication, client-side rendering, consent prompts, bot checks, and page-specific loading can affect what appears in a capture.

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

Or skip the browser setup

If your goal is simply to capture a URL rather than run a browser inside your project, ScreenshotNeo is a website screenshot API and MCP server for developers. A GET request returns a PNG, JPEG, WebP, or PDF. For a WebP screenshot, use this cURL example, substituting your API key and target URL. See the ScreenshotNeo API documentation for current parameters and response details.

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

ScreenshotNeo accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing, with the page verdict and billing status reported in response headers. Its MCP server offers take_screenshot, get_page_info, and capture_pdf tools for AI agents. The Free plan includes 1,000 screenshots a month without a card; paid plans start at $5 for 3,000 shots.

Create a free ScreenshotNeo account to get 1,000 screenshots a month with no card.

Fix common Puppeteer installation and capture errors

“Could not find Chrome” or the expected browser is missing

A common cause is a package manager that blocked dependency install scripts. Puppeteer’s browser download may not have run even though the package installed. Use its documented recovery command:

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

Alternatively, configure the package manager to allow Puppeteer’s install script, then reinstall as appropriate for that package manager. If your setup intentionally uses a system-managed or remote browser, use puppeteer-core and explicitly configure or connect to that browser instead of expecting Puppeteer to download one.

Rank #4
Sale
Web Design with HTML, CSS, JavaScript and jQuery Set
  • Brand: Wiley
  • Set of 2 Volumes
  • A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers

Claude Code cannot find or run the project dependency

Confirm that you installed Puppeteer in the same project directory from which the script is run, and that the project’s Node.js environment can resolve the dependency. Run the script from that directory. A global Claude Code installation does not install Puppeteer into every project.

The screenshot is blank, incomplete, or captured too early

First confirm that the target URL opens from the same machine and environment running the script. A local development URL such as http://localhost:3000 only works if the app is running and reachable there. If the page renders content after navigation, wait for a page-specific selector or other application-ready condition before capturing rather than relying only on network activity. For a document taller than the viewport, set fullPage: true.

Claude Code does not have a browser tool

Installing Puppeteer in a project provides a library for project code; it does not add a new browser-interaction tool to Claude Code. If you need Claude Code to control a browser directly, configure a suitable MCP server using Anthropic’s documentation and the selected server’s own current instructions.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Performance, reliability, and cost considerations

A local Puppeteer workflow gives you control over browser launch, navigation, waits, viewport, and output within your project. It also means your environment must have the compatible browser available, and your script must handle page readiness and failures. The cited Puppeteer guidance does not establish a general install-size, speed, or performance figure, so those will depend on your browser, host, target page, and capture choices.

For repeatable captures, keep the browser cleanup in place, choose a wait condition that matches the page, and make the URL, viewport, and screenshot options explicit. Puppeteer and its browser downloads can change across releases; when diagnosing a version or download issue, check the current official installation guide rather than assuming a particular Chrome version.

Frequently asked questions

Can I use Puppeteer from Python in Claude Code?

Puppeteer is a JavaScript library. The workflow in this guide uses Node.js; the Claude Code project can contain other languages, but Puppeteer itself is installed and called from JavaScript.

Does Puppeteer control Firefox?

Puppeteer’s documentation describes it as a library for controlling Chrome or Firefox. The installation and screenshot example here use the regular package’s compatible Chrome setup.

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

Does installing an MCP server replace Puppeteer?

Not necessarily. An MCP server gives Claude Code tools exposed by that server; a project script using Puppeteer remains a separate approach. Which is appropriate depends on whether you want reusable code in the project or direct browser tools for the agent.

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.