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

page.captureScreenshot is usually a wrapper around a browser screenshot API. Map its options to Playwright’s page.screenshot() (or the equivalent Puppeteer method), then choose a viewport, full-page, clipped, or element capture. A basic Playwright capture is:

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

The exact method name and accepted fields depend on the browser tool or MCP server exposing it, so inspect that tool’s schema before copying an example. The concepts below cover the options most wrappers expose.

What page.captureScreenshot actually does

A screenshot call captures the page as the browser has rendered it. It can write an image file or return image bytes for another program to store, upload, or compare. In Playwright, the underlying operation is page.screenshot(); Puppeteer exposes the same basic capability through its Page.screenshot() API. A wrapper may rename that operation to page.captureScreenshot while preserving familiar options such as fullPage, clip, type, quality, and scale.

Before running a capture, confirm three things in your wrapper documentation: whether the page object is Playwright or Puppeteer based, whether the output is a file path or returned data, and which option names are supported. Unsupported fields are commonly ignored or rejected rather than silently producing the image you intended.

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.

Prerequisites and a reliable capture sequence

  • A running browser and a page object created by your automation framework.
  • A navigated URL, plus a wait for the state you need: document load, a selector, fonts, images, or application data.
  • A writable destination if you pass path.
  • A deterministic viewport and, for visual tests, a consistent browser/device scale.

Take the screenshot only after the content that matters is present. A fast call can capture a loading skeleton, missing web fonts, lazy images, or an unhydrated single-page application. For animated pages, pause or disable animation when your framework supports it; otherwise two captures of the same URL can differ.

Capture the visible viewport

With no fullPage option, Playwright captures the currently visible viewport (the documented default is false). This is the right choice for a hero image, a dashboard at a known scroll position, or a visual regression test of the initial screen.

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

Set the viewport before navigation when dimensions matter. A 1440×900 desktop shot and a 390×844 mobile shot can trigger different responsive layouts, so record those dimensions alongside the artifact in a test or build.

Capture the complete scrollable page

Pass fullPage: true to capture the whole scrollable document rather than only the viewport:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.
await page.screenshot({
  path: 'full-page.png',
  fullPage: true
});

A full-page screenshot is rendered as if the entire scrollable page could fit in one image. Long pages can create very large files and may expose layout problems that are invisible in a viewport shot: sticky headers repeated during stitching, content that appears only after scrolling, or lazy images that never loaded. If your site lazy-loads media, scroll through the page (or use your framework’s lazy-load strategy) before capture and wait for the images to finish.

Capture a rectangular region with clip

Use clip when you need a bounded area such as a chart or banner. The rectangle is measured in CSS pixels from the page’s top-left coordinate system:

await page.screenshot({
  path: 'region.png',
  clip: { x: 0, y: 120, width: 960, height: 540 }
});
  • x and y identify the rectangle’s top-left corner.
  • width and height define its size.
  • The rectangle must intersect the page’s rendered content and use non-negative dimensions.

For a responsive component, calculate the rectangle from its bounding box rather than hard-coding coordinates. If the component is below the fold, scroll it into view first; otherwise a clip can include the wrong area or an empty background.

Capture one element instead of the page

Playwright’s locator API can screenshot a single element, including its rendered bounds:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
await page.locator('.header').screenshot({ path: 'header.png' });

An element screenshot is preferable to manually calculating clip because the locator follows the element when layout changes. Use a selector that identifies one intended element, wait until it is visible, and make sure it is not covered by a modal or cookie banner. Puppeteer offers the equivalent through an element handle.

Choose output format, quality, and scale

Option Effect Use it when
path Writes the image to a file. Without it, the API returns image data. You need a build artifact, upload, or comparison buffer.
type Selects png, jpeg, or webp in APIs that support those formats. Choose PNG for lossless UI/text, JPEG for broadly compatible photos, or WebP for a smaller modern image.
quality Controls lossy quality; it does not apply to PNG. Reduce JPEG/WebP size when minor compression artifacts are acceptable.
scale css produces one pixel per CSS pixel; device preserves device-pixel density and can be larger. Use CSS scale for predictable dimensions or device scale for high-density visual output.
omitBackground Can produce transparency where supported; it does not apply to JPEG. Use for a cutout or compositing workflow that needs transparent pixels.

Do not infer the format solely from a filename when using a wrapper: explicitly set type if its schema supports it. If the wrapper infers type from path, use a matching extension such as .png or .webp.

Returned bytes versus a saved file

Omit path when the next step is in memory:

const imageBytes = await page.screenshot();
// upload imageBytes, store it, or compare it with a baseline

Playwright returns a buffer. Puppeteer can return a buffer or, when requested by its API, a base64 representation. Your page.captureScreenshot wrapper may instead return a data URL, binary response, or JSON field; inspect the result type before writing it. Treat binary data as binary rather than converting it to ordinary text.

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.

Waiting for dependable results

Navigation and application state

Wait for navigation to complete and then for the application state that matters. A page can report that navigation finished while JavaScript is still fetching account data. Wait for a stable selector, a known response, or a short, justified delay when no stronger signal exists.

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

Fonts and images

Web fonts can change line wrapping after the first paint, and images can arrive after the DOM exists. Wait for the relevant font and image promises when your page exposes them. For full-page captures, ensure lazy-loaded media has been triggered before taking the shot.

Animations and transient UI

Freeze animations for visual comparison, or capture at a known time. Hide or dismiss transient overlays only when that reflects the purpose of the screenshot; hiding a consent dialog in a compliance test would invalidate the test.

Common failures and fixes

Symptom Likely cause Fix
Only the top portion appears fullPage was omitted or the wrapper does not support it. Set fullPage: true and verify the wrapper schema.
Blank or partially loaded image Capture ran before data, fonts, or images were ready. Wait for a selector or application-ready signal; then capture.
Clip is offset or empty Coordinates were calculated in a different viewport or scroll position. Use a current bounding box, scroll the target into view, and calculate in CSS pixels.
Element screenshot throws Selector matches nothing, multiple unexpected nodes, or the element is hidden. Use a unique locator, wait for visibility, and check the rendered state.
Unexpectedly huge file Device scale, full-page height, or lossless PNG. Use scale: 'css', a bounded capture, or WebP/JPEG where quality permits.
Transparent output is black or opaque Transparency is unsupported for the chosen format or wrapper. Use PNG with omitBackground: true where supported; never expect transparency from JPEG.
Option rejected as unknown Your wrapper exposes only a subset of Playwright/Puppeteer fields. Read its parameter schema and map only supported options.
Different pixels on every run Animation, time-dependent data, ads, fonts, or responsive dimensions. Fix viewport and data, wait for fonts, disable animation, and remove nondeterministic content.

Performance, reliability, and cost considerations

Viewport and element captures are generally cheaper to process than very tall full-page images because they contain fewer pixels. Large screenshots also consume more memory when returned as buffers. Prefer WebP or JPEG for delivery images, but keep PNG for text-heavy visual comparisons where compression artifacts can create false differences. Reuse a browser session when your automation environment allows it, while creating a fresh page or context when cookies and state could contaminate results.

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

For repeatable tests, save the viewport dimensions, browser version, color scheme, scale, URL, and wait condition with each artifact. A screenshot proves what the renderer displayed at one moment; it does not prove that an API response, accessibility tree, or underlying DOM is correct. For interaction, use locators or accessibility snapshots rather than trying to click coordinates derived from an image.

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.
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 provides a website screenshot API and MCP server. One GET request returns a PNG, JPEG, WebP, or PDF, while options cover full-page captures with lazy images loaded, CSS-selector element captures, dark mode, device presets or custom viewports, retina scale, clipping, custom CSS and JavaScript, click-before-capture, selector or network-idle waits, ad/tracker/request blocking, headers, cookies, user agents, Authorization, timezone, geolocation, transparent backgrounds, resizing, TTL caching, signed links, asynchronous jobs with signed webhooks, bulk capture of up to 100 URLs per call, usage data, and an OpenAPI specification. Parameter names used by other screenshot APIs also work, which can simplify migration.

Before each capture it accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be disabled. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server exposes take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients.

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 documentation for authentication and all parameters. The same request in Python is:

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)

And in Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot failed: ${res.status}`);
const fs = await import('node:fs/promises');
await fs.writeFile('shot.webp', Buffer.from(await res.arrayBuffer()));

The Free plan includes 1,000 shots per month with no card. Paid plans start at $5 for 3,000 shots; every feature is available on every plan, and yearly billing gives two months free. Create a free ScreenshotNeo account to try the 1,000 monthly shots.

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.

FAQ

Is page.captureScreenshot a standard Playwright method?

No. Playwright’s documented method is page.screenshot(); page.captureScreenshot is a name used by some wrappers or browser tools.

Can a screenshot include content outside the current viewport?

Yes. Use fullPage: true for the complete scrollable document or clip for a defined rectangle.

Which format is best for pixel-diff testing?

PNG is usually the safest choice because it is lossless. JPEG and WebP can be smaller but introduce lossy differences.

Why do screenshots differ between machines?

Viewport size, device scale, fonts, animation, time-dependent data, browser versions, and responsive content can all change rendered pixels. Standardize those inputs before comparing images.

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

Frequently Asked Questions

Does fullPage capture require scrolling first?

Not always, but pages that lazy-load content may require a scroll or another explicit load trigger before the full-page call.

Can I use quality with PNG?

No. The documented quality setting applies to lossy JPEG or WebP output, not PNG.

What should I inspect when the wrapper returns an unexpected object?

Check the wrapper’s result schema to determine whether image data is a buffer, base64 value, data URL, or another field before saving it.

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.