Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
browser automation

How to Take a Screenshot with Playwright’s browser_take_screenshot

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

In Playwright’s browser tools, call browser_take_screenshot to capture the active page’s visible viewport. Add fullPage: true to capture the full scrollable page, or set target to capture a particular element. If you mean Playwright automation code in Node.js rather than the browser tool, use page.screenshot() for a page or locator.screenshot() for an element; those are different interfaces with different option names.

Choose the Playwright screenshot interface that fits the task

The name browser.takeScreenshot can be confusing: the browser-tool operation documented for capturing the active page is browser_take_screenshot. In a Node.js Playwright script, the corresponding page method is page.screenshot(). Pick based on where the page is open and what you want to do with the result.

Goal Use What it captures or does
Capture the page open in the Playwright browser tool browser_take_screenshot The visible viewport by default; optionally a target element or the full page.
Save or process a page image from a Node.js automation script page.screenshot() The page viewport by default; optionally the full page. Saves to a path or returns a buffer.
Capture a particular DOM element in Node.js locator.screenshot() A screenshot clipped to the matched element.
Compare a screenshot with an expected image in Playwright Test expect(page).toHaveScreenshot() A visual assertion against a reference image, not just a one-off file capture.

These methods serve related purposes, but their contexts and option names are not interchangeable. For example, the browser tool uses target for an element; Node.js code calls a locator’s screenshot() method.

Capture the active page with browser_take_screenshot

Use the browser-tool screenshot operation when you want an image of the page already open in that browser session. With no scope option, it captures the visible viewport. Set fullPage: true for the entire scrollable document, or provide target to capture an element using its reference or selector.

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
Logitech Brio 101 Full HD 1080p Webcam for Streaming and Meetings - Black
  • Compatible with Nintendo Switch 2’s new GameChat mode
  • Auto-Light Balance: RightLight boosts brightness by up to 50%, reducing shadows so you look your best—compared to previous-generation Logitech webcams (1)
  • Privacy with a Slide: The integrated webcam cover makes it easy to get total, reliable privacy when you're not on a video call
  • Built-In Mic: The built-in microphone lets others hear you clearly during video calls
  • Easy Plug-And-Play: The Brio 101 works with most video calling platforms, including Microsoft Teams, Zoom and Google Meet—no hassle; it just works

A browser-tool call is made through the tool interface rather than as a method in a Node.js Playwright script. Its key options are:

  • target: an element reference or selector to capture. Do not combine it with fullPage.
  • fullPage: captures the full scrollable page instead of only the viewport.
  • type: png, jpeg, or webp. If omitted, the file extension can determine the format; if neither format nor filename extension is supplied, the default is PNG.
  • filename: the chosen output filename. If omitted, the tool returns the image inline as well as saving it to its output location.
  • scale: css produces CSS-pixel sizing; device uses device-pixel ratio for higher-resolution output.

For a saved full-page WebP, conceptually configure the call with fullPage: true, type: "webp", and a filename ending in .webp. For an element, set target and a filename, and leave fullPage off. The browser tool’s exact call syntax depends on the host tool interface; do not paste these options as if they were Node.js code.

Take and save a screenshot with Playwright in Node.js

For scripted browser automation, navigate with a Playwright Page and call page.screenshot(). This minimal example saves the current viewport as a PNG:

const { chromium } = require('playwright');

(async () => {
  const browser = await chromium.launch();
  const page = await browser.newPage();

  await page.goto('https://example.com');
  await page.screenshot({ path: 'screenshot.png' });

  await browser.close();
})();

Use a real destination URL and ensure Playwright is installed in the project before running the script. The path option writes the output file. If you omit path, page.screenshot() returns an image buffer, which you can pass to another function, store yourself, or use in a test.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sale
Logitech C270 720p Webcam Plug-and-Play Wide Screen Video Calling - Black
  • Compatible with Nintendo Switch 2’s new GameChat mode
  • Crisp HD 720p/30 fps video calls with diagonal 55° field of view and auto light correction. Compatible with popular platforms including Skype and Zoom.
  • The built-in noise-reducing mic makes sure your voice comes across clearly up to 1.5 meters away, even if you’re in busy surroundings.
  • C270’s RightLight 2 feature adjusts to lighting conditions, producing brighter, contrasted images to help you look good in all your conference calls.
  • The adjustable universal clip lets you attach the camera securely to your screen or laptop, or fold the clip and set the webcam on a shelf. You’re always ready for your next video call.

Capture the whole scrollable page

Set fullPage: true when the screenshot should include content below the initial viewport:

await page.screenshot({ path: 'full-page.png', fullPage: true });

This captures the full scrollable document, not only what a person could see without scrolling. For pages with content that appears only after scrolling, check that the page has actually loaded the relevant content before capture. Full-page capture does not by itself guarantee that every lazy-loaded image or changing section is ready.

Capture one element

Use a locator’s screenshot method when the output should be clipped to a matched element:

await page.locator('.product-card').screenshot({ path: 'product-card.png' });

The locator screenshot scrolls the element into view and performs actionability checks. If the element is detached from the DOM before the screenshot is taken, the operation errors. The captured image is clipped to the matched element; content in a scrollable element beyond its current scroll position is not included. An element can also be covered by other content, so a successful call does not necessarily mean the result shows it unobstructed.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
NexiGo N60 1080P Webcam with Microphone, Software Control & Privacy Cover, USB HD Computer Web Camera, Plug and Play, for Zoom/Skype/Teams, Conferencing and Video Calling
  • 【Full HD 1080P Webcam】Powered by a 1080p FHD two-MP CMOS, the NexiGo N60 Webcam produces exceptionally sharp and clear videos at resolutions up to 1920 x 1080 with 30fps. The 3.6mm glass lens provides a crisp image at fixed distances and is optimized between 19.6 inches to 13 feet, making it ideal for almost any indoor use.
  • 【Wide Compatibility】Works with USB 2.0/3.0, no additional drivers required. Ready to use in approximately one minute or less on any compatible device. Compatible with Mac OS X 10.7 and higher / Windows 7, 8, 10 & 11 / Android 4.0 or higher / Linux 2.6.24 / Chrome OS 29.0.1547 / Ubuntu Version 10.04 or above. Not compatible with XBOX/PS4/PS5.
  • 【Built-in Noise-Cancelling Microphone】The built-in noise-canceling microphone reduces ambient noise to enhance the sound quality of your video. Great for Zoom / Facetime / Video Calling / OBS / Twitch / Facebook / YouTube / Conferencing / Gaming / Streaming / Recording / Online School.
  • 【USB Webcam with Privacy Protection Cover】The privacy cover blocks the lens when the webcam is not in use. It's perfect to help provide security and peace of mind to anyone, from individuals to large companies. 【Note:】Please contact our support for firmware update if you have noticed any audio delays.
  • 【Wide Compatibility】Works with USB 2.0/3.0, no additional drivers required. Ready to use in approximately one minute or less on any compatible device. Compatible with Mac OS X 10.7 and higher / Windows 7, 10 & 11, Pro / Android 4.0 or higher / Linux 2.6.24 / Chrome OS 29.0.1547 / Ubuntu Version 10.04 or above. Not compatible with XBOX/PS4/PS5.

Choose output format, scale, and stability controls

Image formats and dimensions

The browser tool supports PNG, JPEG, and WebP. Node.js screenshot APIs also support image type selection and quality settings for JPEG or WebP. Use a lossless format such as PNG when visual detail matters; use JPEG or WebP when a smaller image is more useful than pixel-for-pixel preservation. The correct trade-off depends on what consumes the image, so inspect the saved output rather than assuming a particular format will meet a size target.

In the browser tool, choose scale: 'css' when dimensions in CSS pixels matter, or scale: 'device' when you want output sized according to the device-pixel ratio. These settings affect output resolution, not the CSS layout viewport itself. A device-scaled capture can be larger in pixel dimensions and file size.

Control animation and dynamic content

For a repeatable image, first make the page state repeatable: wait for the relevant content, avoid taking the shot mid-transition, and control changing data where practical. Node.js Page and Locator screenshot APIs expose animation handling and masking controls. Masking selected locators can help when volatile regions should not affect a visual comparison. Exact option availability differs by API, so use the options for the specific method you call rather than assuming the browser tool and Node.js methods accept the same settings.

A screenshot is a snapshot, not a guarantee that the page is fully loaded or visually correct. If a page includes delayed content, coordinate the capture with the page’s own readiness conditions. For example, in Node.js you can wait for an element before capturing:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
EMEET C960 1080P Webcam with Microphone, 2 Mics, 90° FOV, Computer Camera
  • 1080P Webcam with Cover for Video Calls - EMEET computer webcam provides design and Optimization for professional video streaming. Realistic 1920 x 1080p video, 5-layer anti-glare lens, providing smooth video. C960 computer camera delivers 1920x1080 video with fixed focus (11.8–118.1 inches), so as to provide a clearer image. C960 USB webcam has a cover and can be removed automatically to meet your needs for privacy. For optimal image performance, use the webcam in a well-lit environment.
  • Built-in 2 Omnidirectional Mics - EMEET webcam with microphone for desktop features 2 built-in omnidirectional microphones, picking up your voice to create clear audio for communication. When installing the webcam, select EMEET C960 as the default microphone input device in your computer and video applications and select C960 as the default device in Zoom/Teams and ensure microphone permissions are enabled for proper use. Please note that C960 does not include built-in speakers.
  • Automatic Light Adjustment - Automatic exposure adjustment is applied in EMEET HD webcam 1080p so that the streaming webcam can deliver stable image performance. EMEET C960 camera for computer also features color adjustment and exposure optimization to help you look your best. For optimal video quality, it is recommended to use the webcam in normal or well-lit environments and select suitable video settings in your application. Proper lighting helps achieve a clearer and more balanced image.
  • Plug-and-Play & Upgraded USB Connectivity - New C960 webcam features both USB Type-A & A-to-C adapter connections for wider compatibility. For stable performance, connect the webcam directly to the computer's main USB port and ensure the device is recognized correctly. If a hub or docking station is used, please ensure it provides sufficient power and stable data transmission, as limited ports may affect performance. 90° wide-angle lens captures more participants without frequent adjustments.
  • High Compatibility & Multi Application - C960 webcam for laptop is compatible with Windows 10/11, macOS 10.14+, and Android TV 7.0+. Not supported: Windows Hello, TVs, tablets, or game consoles. It works with Zoom, Teams, Facetime, Google Meet, YouTube and more. Please select C960 webcam as the default camera and microphone device in your application and ensure camera/microphone permissions are enabled, especially on macOS. (Tips: Incompatible with Windows Hello)
await page.goto('https://example.com');
await page.locator('main').waitFor({ state: 'visible' });
await page.screenshot({ path: 'ready-page.png' });

The selector and readiness condition should reflect the page you are automating; a visible main container may not mean every image or live widget has finished updating.

Use screenshot assertions for visual regression tests

If the goal is to catch visual changes, use Playwright Test’s toHaveScreenshot() assertion instead of treating a manually saved image as a test. It compares a capture against a reference image and waits for two consecutive screenshots to match before comparing the last one with the expectation.

import { test, expect } from '@playwright/test';

test('home page matches its visual baseline', async ({ page }) => {
  await page.goto('https://example.com');
  await expect(page).toHaveScreenshot();
});

First runs may create a reference image, depending on the test workflow; review generated or updated baselines rather than automatically accepting every difference. Screenshot comparisons can vary with operating system, browser version, browser settings, hardware, power source, and headless mode. Generate and compare reference images in a consistent environment, and treat intentional design changes as deliberate baseline updates.

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

Troubleshoot common screenshot problems

The image shows only the top of the page

That is the default viewport capture. For the browser tool, set fullPage: true; in Node.js, use page.screenshot({ fullPage: true }). If the missing content is inside a scrollable container rather than the document, full-page capture may not reveal the container’s off-screen contents. Scroll that container or capture the relevant state explicitly.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Logitech C920x HD Pro PC Webcam Full 1080p/30fps Video - Black
  • Compatible with Nintendo Switch 2’s new GameChat mode
  • HD lighting adjustment and autofocus: The Logitech webcam automatically fine-tunes the lighting, producing bright, razor-sharp images even in low-light settings. This makes it a great webcam for streaming and an ideal web camera for laptop use
  • Advanced capture software: Easily create and share video content with this Logitech camera that is suitable for use as a desktop computer camera or a monitor webcam
  • Stereo audio with dual mics: Capture natural sound during calls and recorded videos with this 1080p webcam, great as a video conference camera or a computer webcam
  • Full HD 1080p video calling and recording at 30 fps. You'll make a strong impression with this PC webcam that features crisp, clearly detailed, and vibrantly colored video

The element screenshot fails or is incomplete

Check that the selector matches an element and that it remains attached through the capture. Locator screenshots scroll the target into view and run actionability checks, but they fail if the element detaches. Also inspect whether another element covers the target and whether the part you need is outside an internal scroll area’s current position.

The output file has an unexpected format or size

Specify a type and a matching filename extension instead of relying on inference. The browser tool defaults to PNG when neither is supplied. For the browser tool, choose CSS scale for CSS-pixel output or device scale for device-pixel-ratio output; larger pixel dimensions can increase image size. In Node.js, set the screenshot type and, for JPEG or WebP, a quality option when appropriate.

The visual test fails on a different machine

Make the browser and host environment consistent between baseline generation and comparison. Differences in OS, browser version, settings, hardware, power source, or headless mode can affect the screenshot. Review the changed image and distinguish an actual UI regression from an environment difference before updating the reference.

The screenshot is being used to decide what to click

Do not use a screenshot as the source of interaction references. Playwright’s browser-tool guidance says screenshots are for looking at, not acting on; use browser_snapshot to get references for interaction. A screenshot is useful visual evidence, but it is not a substitute for the browser’s structured interaction information.

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

Or skip the browser setup

If you need an image or PDF through an API rather than managing a Playwright browser, ScreenshotNeo is a website screenshot API and MCP server for developers. One GET request returns a screenshot or PDF. For example, this cURL command saves a WebP capture:

Quick Recap

SaleBestseller No. 1
Logitech Brio 101 Full HD 1080p Webcam for Streaming and Meetings - Black
Logitech Brio 101 Full HD 1080p Webcam for Streaming and Meetings - Black
Compatible with Nintendo Switch 2’s new GameChat mode; Built-In Mic: The built-in microphone lets others hear you clearly during video calls
$35.90
SaleBestseller No. 2
Logitech C270 720p Webcam Plug-and-Play Wide Screen Video Calling - Black
Logitech C270 720p Webcam Plug-and-Play Wide Screen Video Calling - Black
Compatible with Nintendo Switch 2’s new GameChat mode
$16.89
Bestseller No. 5
Logitech C920x HD Pro PC Webcam Full 1080p/30fps Video - Black
Logitech C920x HD Pro PC Webcam Full 1080p/30fps Video - Black
Compatible with Nintendo Switch 2’s new GameChat mode; Fully compatible with Windows 11
$69.99
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 API details. Its clean-shot flow accepts cookie or consent banners like a visitor and removes known consent platforms, newsletter popups, and chat widgets before capture; each of those steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing, and responses indicate the page verdict and billing status in headers. An MCP server offers take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots. Sign up for ScreenshotNeo’s free plan to try it with no card.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

Read next

Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.