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

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

Use Playwright’s screenshot API with an explicit type: 'webp' option or a .webp filename. For example, await page.screenshot({ path: 'capture.webp', type: 'webp' }) writes a WebP image. The same API supports full-page, element, in-memory, transparent and quality-controlled captures.

Save a basic WebP screenshot

Install Playwright in a Node.js project, launch a browser, navigate to the page, capture it and close the browser:

import { chromium } from 'playwright';

const browser = await chromium.launch();
const page = await browser.newPage();
await page.goto('https://example.com');
await page.screenshot({ path: 'capture.webp', type: 'webp' });
await browser.close();

The explicit type: 'webp' makes the output format unambiguous. If you provide a path, Playwright can also infer the format from its extension: a path ending in .webp produces WebP. The documented screenshot types are png, jpeg and webp.

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.

Choose how much of the page to capture

Viewport screenshot

The basic call captures the current viewport. Set the viewport when a predictable layout is important:

#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
const page = await browser.newPage({
  viewport: { width: 1440, height: 900 }
});
await page.goto('https://example.com');
await page.screenshot({ path: 'viewport.webp', type: 'webp' });

Full scrollable page

Set fullPage: true to capture the page’s full scrollable area rather than only what is visible:

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

Long pages can contain lazy-loaded images that are not requested until they approach the viewport. If the page does not load those assets during capture, trigger the site’s normal scrolling or wait for a known element before taking the shot. Playwright’s full-page option controls the capture area; it does not guarantee that every application-specific lazy-loading strategy has completed.

Capture one element

Use a locator when you need a component instead of the whole document:

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

The locator must resolve to an element that is present and capturable. A stable selector such as a test id is generally safer than a deeply nested CSS path.

Keep the image in memory

Omit path when another service will upload or process the result. The method returns image bytes:

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.
const bytes = await page.screenshot({ type: 'webp' });
// bytes is a Buffer in Node.js

Control WebP quality, scale and transparency

Quality

For formats other than PNG, Playwright documents a quality value from 0 to 100. For WebP, quality 100 produces lossless output; lower values are lossy:

await page.screenshot({
  path: 'compressed.webp',
  type: 'webp',
  quality: 80
});

There is no universal quality setting or guaranteed file-size reduction for every page. Text, gradients, photographs and transparent artwork can respond differently, so choose a value that meets your visual requirements and measure the files generated by your own pages.

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.

CSS pixels versus device pixels

The scale option determines output pixel density. scale: 'css' produces one image pixel per CSS pixel. scale: 'device' uses device pixels and can create substantially larger images on high-DPI displays. The documented default is 'device'.

await page.screenshot({
  path: 'css-scale.webp',
  type: 'webp',
  scale: 'css'
});

Use CSS scale when compact, layout-sized artifacts are more useful. Use device scale when you need the detail represented by a high-DPI display. For visual regression, keep the same scale in every baseline and comparison run; changing it changes the pixel dimensions and can make every image appear different.

Transparent backgrounds

omitBackground: true allows a transparent capture when the receiving format supports it:

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.
await page.screenshot({
  path: 'transparent.webp',
  type: 'webp',
  omitBackground: true
});

JPEG cannot represent transparency. WebP and PNG are the relevant choices when an alpha channel matters, and your image pipeline must preserve that transparency after Playwright writes it.

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

Use WebP in Playwright Test visual snapshots

Named WebP snapshot

Playwright Test accepts a WebP filename in toHaveScreenshot:

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

test('homepage visual snapshot', async ({ page }) => {
  await page.goto('https://example.com');
  await expect(page).toHaveScreenshot('homepage.webp');
});

Visual snapshot assertions require the Playwright Test runner, not just the browser automation library. The assertion waits for two consecutive captures to match before comparing the result. Animation handling is disabled by default for screenshot assertions, which removes one common source of variation.

Make WebP the default for unnamed snapshots

import { defineConfig } from '@playwright/test';

export default defineConfig({
  expect: {
    toHaveScreenshot: {
      type: 'webp',
    },
  },
});

This configuration applies when a snapshot name does not itself establish another format. Keep the configuration consistent between the run that creates baselines and the runs that compare against them.

A practical capture sequence for dynamic pages

  1. Set a deterministic environment. Fix the viewport, locale, timezone and any test data that affects layout.
  2. Navigate and wait for the state you need. A page-load event alone may not mean that application data, fonts or images are ready. Wait for a specific selector or application condition where possible.
  3. Remove intentional motion. Screenshot assertions handle animation, but application-controlled transitions, timers and continuously changing content can still make a plain screenshot unstable.
  4. Select the capture scope. Use the viewport for a screen artifact, fullPage for a document, or a locator for a component.
  5. Choose format controls. Set WebP explicitly, then select quality, scale and transparency to match the destination.
  6. Save or process the bytes. Use path for a file or the returned bytes for object storage, an upload, or another image pipeline.

Compatibility and version considerations

The official Playwright API documentation describes WebP support for screenshots. A release-note result reports Page and Locator screenshot WebP support in Java as added in Playwright 1.62, but that single version note is not a complete compatibility matrix. Do not infer that every language binding, browser engine or older installed version gained support at the same time. Check the API page and release notes for the exact binding and version in your project if compatibility is uncertain.

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)
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting WebP captures

The file is PNG or another format

Check both the option and the path. Use type: 'webp' and a .webp filename. If a wrapper around Playwright supplies its own options, inspect the final options object reaching screenshot.

The screenshot call fails because the page is not ready

Navigate first, then wait for a selector or application-specific ready condition. For an element screenshot, verify that the locator resolves to a visible, stable element. Avoid relying only on an arbitrary short delay when a deterministic condition is available.

Lazy images are missing in a full-page image

Full-page capture expands the capture area, but a site may load images only after scroll events or an intersection observer fires. Scroll through the page or wait for the relevant image requests and selectors before calling fullPage: true.

Visual tests fail even though the page looks unchanged

Keep viewport, browser, scale, font availability and WebP quality identical. Wait for dynamic content, disable or freeze clocks where your test architecture permits, and capture after the page reaches a stable state. A switch between CSS and device scale changes every pixel dimension.

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

Transparency is lost

Confirm that you used omitBackground: true, selected WebP or PNG rather than JPEG, and that the next image-processing or storage step preserves alpha data.

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

Performance, reliability and cost choices

  • Scope: viewport and element captures generally process less content than a full-page capture, while full-page output is appropriate for document archives and long-page review.
  • Quality: quality 100 gives lossless WebP; lower values trade fidelity for lossy compression. The documentation does not promise a particular byte reduction.
  • Scale: CSS scale limits output to CSS dimensions; device scale can increase pixels and transfer size, especially on high-DPI contexts.
  • Stability: deterministic waits and consistent rendering settings matter more for regression tests than simply choosing WebP.
  • Storage: in-memory bytes avoid an intermediate file when your next step is an upload, but write a path when you need a reproducible local artifact for debugging.

Frequently asked questions

Can Playwright capture WebP without writing a file?

Yes. Call page.screenshot({ type: 'webp' }) without path; Playwright returns the encoded image bytes.

Does WebP quality 100 mean lossless output?

For WebP, Playwright documents quality 100 as lossless. Values below 100 are lossy.

Which scale should a visual baseline use?

Choose CSS or device scale based on the artifact you need, then use that same choice for every baseline and comparison capture.

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

Is WebP support identical in every Playwright language binding?

Not necessarily. The available documentation does not establish a complete cross-binding and browser matrix, so verify the API and release notes for your installed binding and version.

Or skip the browser setup

ScreenshotNeo provides a website screenshot API and MCP server when you want a WebP response without managing a Playwright browser. A single GET request can return a PNG, JPEG, WebP or PDF. The API accepts options for full-page capture, an element CSS selector, dark mode, device and viewport settings, retina scale, custom CSS or JavaScript, clicks, waits, blocking ads or resource types, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, 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

See the ScreenshotNeo documentation for parameter details. The same request in Python:

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
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)

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}`);
const image = Buffer.from(await res.arrayBuffer());

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 disabled. Bot checks, blank pages, timeouts, failed loads and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server includes take_screenshot, get_page_info and capture_pdf for Claude, Cursor and other MCP clients. The Free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 screenshots. Create a free ScreenshotNeo account.

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

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.