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

page.evaluate() runs JavaScript in the web page; it does not take the screenshot. After the page-side work finishes, capture the rendered page with Puppeteer’s page.screenshot(). For a single element, use the element handle’s screenshot() method instead.

What page.evaluate() does—and what it does not do

Puppeteer’s Page.evaluate(pageFunction, ...args) evaluates a function in the page’s JavaScript context and returns that function’s result. Puppeteer also awaits a Promise returned by the page function. The return value is data from your function, not a screenshot file. The official API reference reviewed for this guide displays Puppeteer version 25.12.0; check the documentation for the version installed in your project if you need version-specific details: Page.evaluate() API reference.

Screenshot capture is a separate operation on Puppeteer’s Page object. The official guide puts it plainly: “For capturing screenshots use Page.screenshot().” See the Puppeteer screenshots guide.

Capture a page after running page-side JavaScript

Await page.evaluate() first, then await page.screenshot(). This example saves the screenshot to a file:

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.
#1 Best Overall
Sale
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
  • A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents
const result = await page.evaluate(() => {
  // Read or change page content here.
  return document.title;
});

await page.screenshot({ path: 'screenshot.png' });

result contains the title returned by the page function. The screenshot comes from the later Puppeteer call. The example assumes you already have a page object and have navigated to the page you want to capture.

Make the capture work in a complete script

Here is a runnable Node.js example using Puppeteer’s browser launcher. Install Puppeteer in your project with npm install puppeteer, save this as screenshot.js, and run node screenshot.js.

const puppeteer = require('puppeteer');

async function main() {
  const browser = await puppeteer.launch();

  try {
    const page = await browser.newPage();
    await page.goto('https://example.com');

    const title = await page.evaluate(() => document.title);
    console.log('Page title:', title);

    await page.screenshot({ path: 'screenshot.png' });
  } finally {
    await browser.close();
  }
}

main().catch((error) => {
  console.error(error);
  process.exitCode = 1;
});

This uses Puppeteer’s documented file-path capture pattern. It does not prescribe a universal readiness wait: the right condition depends on the page and what you need in the image. A completed goto() or an arbitrary delay does not establish that every font, image, animation, or lazy-loaded item is ready.

Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
  • SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors

Capture one element instead of the whole page

If the target is one element, wait for it and call screenshot() on the returned element handle:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
const element = await page.waitForSelector('.report-card');
if (!element) {
  throw new Error('Could not find .report-card');
}

await element.screenshot({ path: 'report-card.png' });

Replace .report-card with a selector that matches the element on your page. Puppeteer’s guide says ElementHandle.screenshot() tries to scroll the element into view if it is hidden.

Choose the screenshot output you need

The file-path option is useful when you want an image saved directly to disk. If you need to pass the image to another part of your program, omit path and use the returned bytes:

Rank #3
Sale
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
  • Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
  • Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
  • In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
  • Ultra-thin bezels: Maximize your viewing experience with thin bezels.
const imageBytes = await page.screenshot();
// imageBytes is a Uint8Array by default.

The API also documents a base64-string return when you request base64 encoding:

const imageBase64 = await page.screenshot({ encoding: 'base64' });

These output forms are documented in the Page.screenshot() API reference. Choose bytes for binary processing or storage in your application; choose base64 when a downstream interface specifically expects an encoded string. Avoid converting formats or encodings unless the next step requires it.

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

Coordinate page changes and screenshot timing

Because page.evaluate() can return a Promise and Puppeteer awaits it, you can await page-side work before asking Puppeteer for the image. For example, if your own page code updates content and returns only after that update, the subsequent screenshot call happens afterward. The exact signal for image readiness is application-specific; the reviewed Puppeteer documentation does not establish a universal wait that guarantees fonts, images, animations, and lazy content are all ready.

Rank #4
Sale
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
  • SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
  • MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
  • KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
  • INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient

The API reference documents one concurrency detail: during a screenshot in a BrowserContext, BrowserContext.newPage(), Browser.newPage(), and Page.close() wait for the screenshot to finish, while Page.bringToFront() does not wait for existing screenshot operations. If your script coordinates screenshots with page creation, closure, or focus changes, account for that difference.

Troubleshoot common problems

  • You got a value from evaluate(), not an image. That is expected: the result is whatever the page function returned. Call await page.screenshot(...) separately on the Puppeteer Page.
  • The output file is missing. Confirm the script reached the awaited screenshot call, that the process can write to the requested path, and that you are checking the directory where the script writes relative paths.
  • The element capture fails or targets nothing. Check that the selector matches the page’s actual markup and that the element exists when waitForSelector() runs. Handle a missing result rather than calling screenshot() on it.
  • The image omits content you expected. A screenshot records the page state at capture time. Identify the application-specific signal that means the required content has rendered, await it, and then capture; do not assume one generic wait makes all page resources ready.
  • Other page operations seem to wait for the screenshot. The documented BrowserContext and Browser page-creation methods and Page.close() wait for an in-progress screenshot. Page.bringToFront() does not wait for existing screenshot operations.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

ScreenshotNeo offers a one-request screenshot API. For example, use this cURL command to save a WebP capture of Stripe:

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

See the ScreenshotNeo API documentation for request options. ScreenshotNeo removes cookie banners, newsletter popups, and chat widgets before the shot; each cleanup step can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and the response identifies the page verdict and billing status. Its MCP server lets AI agents use screenshot tools. The Free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 shots. Learn more at ScreenshotNeo.

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.

Sign up free for 1,000 screenshots a month—no card required.

Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
  • 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
  • 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.

Frequently Asked Questions

Can page.evaluate() return a screenshot?

It returns the result of the page function you pass to it. Use Puppeteer’s page.screenshot() for a page image, or an element handle’s screenshot() for one element.

What does page.screenshot() return if I do not specify a path?

The documented default return type is a Uint8Array. With encoding: 'base64', the documented overload returns a string.

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.

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