The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →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 page.screenshot() method to capture a browser page in Node.js. Pass a path to save an image, set fullPage: true for the full scrollable document, or omit path to receive an in-memory Buffer. For one element, use page.locator(selector).screenshot().
Install Playwright and capture a page
The basic workflow is to launch a browser, open a page, navigate to a URL, capture it, and close the browser. The following CommonJS example writes a PNG to the current working directory. Playwright infers the image type from the file extension when you provide a path. See the Page API documentation for the screenshot options and browser examples.
const { chromium } = require('playwright');
(async () => {
const browser = await chromium.launch();
try {
const page = await browser.newPage();
await page.goto('https://example.com');
await page.screenshot({ path: 'screenshot.png' });
} finally {
await browser.close();
}
})();
Install the playwright package in your project before running this script, and install the browser binaries required by your setup if they are not already available. The cited API example uses WebKit; it notes that Chromium or Firefox can be used instead. The example above uses Chromium.
The try/finally block ensures the browser is closed even if navigation or capture throws an error. In a longer-running application, you may keep a browser instance open and create or close pages as needed rather than launching a browser for every capture.
#1 Best Overall
- 【1080P 60FPS Video Capture Card】 This HDMI game capture card is based on USB3.0 high speed transmission port, input resolution up to 4K@30HZ, output resolution up to 2K@30Hz or 1920×1080@60Hz. Type c and USB interface can meet most of the devices in daily life. Easily meet the online capture, real-time recording, online meetings, live gaming and other functions, so you have a better visual enjoyment. Note: For capture use only; requires capture software to function and is not intended for direct screen casting to a monitor or TV
- 【Ultra Low Latency Screen Sharing】 HDMI capture card is made of good quality aluminum alloy with strong heat dissipation, allowing you to enjoy ultra low latency while live gaming or video recording or live streaming, avoiding blue screens and lag. This HDMI to USBC capture card supports easy recording of good quality audio or HD video and transferring it to your computer or streaming platform, allowing you to record 60 fps HD video directly on your hard drive and real-time preview
- 【Plug and Play, Easy to Carry】 This HDMI 1080P video capture card does not require any additional drivers or external power supply, just plug and play for fast capture. The capture card is small and lightweight, so you can put it in your bag for emergencies, making it very portable for outdoor live streaming. It's also a great way to share content in game recording, video conference, video recorder and online teaching
- 【Wide Compatibility USB Capture Card】 Easily streams to Facebook, Youtube or Twitch. With the connection, this HDMI to USB C/3.0 video capture devices can be working on several Operating Systems and various software: Windows 7/ 8/ 10, Mac OS or above, Linux, Android, Laptop, Xbox One, PS3/PS4/PS5, Camera, DVDs, Set Top Box, Webcame, DSLR, Switch/Switch 2, TV BOX, HDTV, Potplayer/VLC, ZOOM, OBS Studio etc.
- 【Package Content & Note】 1x HD Audio Capture Card , 1x USB 3.0 to USB C Adapter (A-side 3.0, B-side 2.0), 1x user manual. Please note that you need to restart the OBS Studio software after the audio setup is complete, otherwise it will result in no sound output. When using an adapter, if the device is recognized as USB 2.0, try using the other side with the USB-C port. Simply flip the capture card and reconnect it to be recognized as USB 3.0
Choose what to capture
| What you need | Playwright call | What it captures |
|---|---|---|
| Visible viewport | page.screenshot({ path: 'shot.png' }) |
The current viewport; fullPage defaults to false. |
| Full scrollable page | page.screenshot({ path: 'shot.png', fullPage: true }) |
The document as if it fit on a very tall screen. |
| One element | page.locator('.card').screenshot({ path: 'card.png' }) |
The locator’s bounds after Playwright brings it into view. |
| Image in memory | const image = await page.screenshot() |
A Buffer; no file is written unless you save it yourself. |
| Test failure evidence | use: { screenshot: 'only-on-failure' } |
An automatic Playwright Test screenshot when the configured condition occurs. |
Capture the current viewport
A plain page.screenshot({ path: 'shot.png' }) records the currently visible viewport. This is the right choice when you want to reproduce what a user sees at a specific scroll position or when you have deliberately set the viewport dimensions.
Capture the full page
Set fullPage: true to capture the full scrollable document rather than only the current viewport:
await page.screenshot({ path: 'full-page.png', fullPage: true });
This makes a tall image rather than a sequence of separate viewport images. Full-page capture does not mean that every interactive state or hidden panel on a site becomes visible; it captures the rendered page as a tall screenshot.
Recommended Free Tools
Capture a single element
Use a locator when the target is a specific component. Locator screenshots scroll the target into view and wait for actionability checks:
await page.locator('[data-testid="receipt"]').screenshot({
path: 'receipt.png'
});
The screenshot is limited to the element’s bounds. Content hidden behind an overlay may not appear, and a scrollable container shows only the content currently scrolled into view. If the target detaches from the DOM during capture, the locator screenshot throws an error. Locator screenshot support was added in Playwright v1.14; consult the Locator API documentation.
Get an image Buffer instead of saving a file
Omitting path returns a Buffer. That is useful when the next step is to upload the image, compare pixels, or store it using application code rather than writing it directly from Playwright.
const imageBuffer = await page.screenshot();
// Pass imageBuffer to your image-processing or storage code.
The Buffer contains the encoded image bytes. Select the desired encoding with the type option when you need a specific format.
Rank #2
- 【1080P HD High Quality】Capture resolution up to 1080p for video source and it is ideal for all HDMI devices such as PS4, PS3, Xbox One, Xbox 360, Wii U, DVDs, DSLR, Camera, Security Camera and set top box. Note: Video input supports 4K30/60Hz and 1080p120/144Hz. Does not support 4K120Hz/144Hz. Output supports up to 2K30Hz.
- 【Plug and Play】No driver or external power supply required, true PnP. Once plugged in, the device is identified automatically as a webcam. Detect input and adjust output automatically. Won't occupy CPU, optional audio capture. No freeze with correct setting.
- 【Compatible with Multiple Systems】suitable for Windows and Mac OS. High speed USB 3.0 technology and superior low latency technology makes it easier for you to transmit live streaming to Twitch, Youtube, Facebook, Twitter, OBS, Potplayer and VLC.
- 【HDMI LOOP-OUT】Based on the high-speed USB 3.0 technology, it can capture one single channel HD HDMI video signal. There is no delay when you are playing game live.
- 【Support Mic-in for Commentary】Rybozen capture card has microphone input and you can use it to add external commentary when playing a game. Please note: it only accepts 3.5mm TRS standard microphone headset.
Set format, quality, size, and transparency
Playwright supports PNG, JPEG, and WebP. PNG is the default. When saving to a path, its extension can determine the format; for clarity, you can also specify type.
| Option | Behavior |
|---|---|
type |
'png', 'jpeg', or 'webp'. Default: PNG. |
quality |
Integer from 0 to 100 for JPEG and WebP; it does not apply to PNG. JPEG defaults to 80; WebP defaults to 100, which is lossless. |
omitBackground |
With true, hides the default white background for transparency. It does not apply to JPEG. |
For example, a WebP image with a chosen lossy quality can be written like this:
await page.screenshot({
path: 'page.webp',
type: 'webp',
quality: 85
});
Use PNG when you need the default lossless format, or when you want crisp UI text and exact pixel values. JPEG is often appropriate when a smaller photographic image matters more than lossless detail. WebP quality 100 is lossless; lower quality values are lossy. These are format trade-offs, not guarantees about a particular file size: output size depends on the page content.
For a transparent PNG, use omitBackground: true. Do not use that option expecting transparency in a JPEG, which does not support it.
Control image dimensions and capture region
By default, screenshots use device scale, so a high-density display can produce an image with more pixels than the page’s CSS dimensions. Set scale: 'css' for one image pixel per CSS pixel, or scale: 'device' for one pixel per device pixel:
await page.screenshot({ path: 'css-sized.png', scale: 'css' });
Device scale can produce an image twice as large or larger than CSS-sized output. Choose based on whether you want compact, CSS-pixel dimensions or device-resolution detail.
Use clip to capture a rectangular region specified by x, y, width, and height. Use fullPage when your goal is the full scrollable page; these options answer different capture needs.
Rank #3
- AV TO USB Converter: Capture videos and audios from VHS, VCR, Hi8, DV tapes to a PC, with the help of our USB Video Converter. Save room while digitizing your favorite old memories
- Quality Capture Card: Our USB Video Capture Card converting anolog RCA composite input into HD 720P USB output and capturing audio without any sound card. Advanced signal processing technology provides you with great precision, colors, resolutions, and details.
- Plug and Play: Automatically install the driver once you hook up this RCA to USB Converter to a PC. No external power is needed. User-friendly and easy to operate
- Wide Compatibility: The Video Capture Card can work with video devices with RCA connector or S-Video connector, such as VHS, VCR, Hi8, camcorder, compatible with Windows and Mac OS. Support video formats like NTSC, PAL, and support brightness, contrast, hue, and saturation control
- Note: The Video Converter is used with acquisition software. We recommend OBS Studio or PotPlayer for Windows, and QuickTime Player for Mac. They can be downloaded for free online. Please operate according to the steps in User Manual or contact us if you have any questions
Make screenshots more repeatable
Dynamic pages can produce inconsistent images because animations, blinking carets, or changing content alter pixels between runs. Playwright provides options to control some of these sources of variation:
animations: 'disabled'fast-forwards finite animations and cancels infinite animations during capture, then restores them.caret: 'hide'hides the text caret.maskaccepts locators whose matched regions should be masked.styleinjects a stylesheet for the capture.
These options are available for page screenshots and, where supported by the locator API, element screenshots. Use them when the capture should be stable across runs, but avoid hiding or masking information that the screenshot is meant to verify.
Wait for the page to be ready
Navigation completion and screenshot readiness are not always the same thing. A site may render content after navigation, load images lazily as the page scrolls, or show an element only after client-side work. Navigate first, then wait for a meaningful condition before capturing. For example:
await page.goto('https://example.com');
await page.locator('main').waitFor();
await page.screenshot({ path: 'page.png', fullPage: true });
The screenshot call’s own timeout defaults to zero. You can change the default timeout using browserContext.setDefaultTimeout() or page.setDefaultTimeout(). For page-specific waiting, use a selector or other condition that signals the content you need, rather than assuming a fixed delay will suit every run.
The Page API documentation lists an AbortSignal option for screenshots as added in Playwright v1.62. Because the API documentation is under the forward-looking /next path and does not specify one package version for the entire page, verify that option against the Playwright version installed in your project before relying on it.
Use automatic screenshots in Playwright Test
If the goal is to keep evidence when tests fail, Playwright Test can capture screenshots automatically. Set the screenshot mode in the test configuration:
import { defineConfig } from '@playwright/test';
export default defineConfig({
use: {
screenshot: 'only-on-failure',
// Set fullPage when full-document failure evidence is needed.
// screenshot: { mode: 'only-on-failure', fullPage: true },
},
});
Playwright Test supports off, on, only-on-failure, and on-first-failure screenshot modes. Configure fullPage in screenshot configuration when full-page failure evidence is useful. See the Playwright Test use options.
Rank #4
- 【4K HDMI Input, 2K@30Hz Recording】Powered by a true USB 3.0 high-speed interface, the capture card supports up to 4K@30Hz HDMI input and records at 2K@30Hz or 1080P@60Hz. Perfect for gamers, streamers, and professionals who need crisp, smooth video for live streaming, gameplay recording, or online meetings.
- 【Ultra Low Latency Screen Sharing】Built with a premium aluminum alloy shell and advanced chipset for stable heat dissipation, ensuring ultra-low latency transmission. Capture high-quality video and dual-channel audio in real time—no lag, no frame drop—ideal for Twitch, YouTube, or OBS streaming.
- 【Easy Plug and Play, Compact & Portable】No driver or external power required—just plug and play via USB 3.0 or Type-C connection to your Windows or macOS computer. Lightweight and compact design makes it easy to carry for outdoor streaming, live shows, or mobile recording setups.
- 【Wide Compatibility & Multi-Device Support】Compatible with Windows 7 8 10 11, macOS, Linux,Android and supports most popular software such as OBS, Zoom, VLC, Twitch Studio, and more. Works seamlessly with PS4, PS5, Xbox, Switch, DSLR cameras, TV boxes, and other HDMI-output devices for streaming to YouTube, Twitch, etc.
- 【What You Get】Includes: HDMI Capture Card, USB 3.0 to USB-C Adapter, User Manual. Tips: Make sure your tablet’s OTG function is enabled before connecting. Test your HDMI device with a monitor first to confirm video and audio output, then connect to the Video Capture Card for recording.
Use the standalone Page API when your application needs to choose the exact capture point or process a returned Buffer. Use Playwright Test’s automatic mode when the screenshot is test-run evidence attached to execution.
Common problems and fixes
- The image is saved somewhere unexpected. A relative
pathresolves from the process’s current working directory. Use an absolute path or check the directory from which Node.js was launched. - The image shows only the viewport. That is the default. Set
fullPage: truefor the full scrollable document. - The image is too large. Device scale is the default and can yield twice as many pixels or more. Try
scale: 'css'if CSS-pixel dimensions are sufficient. - A locator screenshot fails because the element disappeared. The locator API throws if the target is detached from the DOM. Wait for the relevant application state, then locate and capture the element.
- Part of a component is missing. A locator screenshot captures the element’s bounds; overlays may cover content, and scrollable containers show only their current scroll position. Remove or account for the overlay, or scroll the container to the required content before capture.
- PNG quality settings appear to do nothing. The
qualityoption does not apply to PNG. Use JPEG or WebP if lossy quality control is what you need. - A transparent background is opaque. Set
omitBackground: trueand use a format that supports transparency, such as PNG; this option does not apply to JPEG. - The capture is inconsistent between runs. Wait for a page-specific ready condition and consider disabling animations, hiding the caret, masking volatile regions, or injecting a stable stylesheet.
- A newer option is rejected by the installed package. Check the installed Playwright version against the API documentation. In particular, the Page API lists screenshot
AbortSignalsupport as added in v1.62.
Or skip the browser setup
If you need a screenshot through an API instead of managing a Playwright browser, ScreenshotNeo returns an image or PDF from a GET request. Its API accepts the URL and can return PNG, JPEG, or WebP; see the ScreenshotNeo API documentation.
Free tools Windows power users keep installed
One-click scans. No signup required.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
ScreenshotNeo accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each of those steps can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server offers take_screenshot, get_page_info, and capture_pdf tools for AI agents and MCP clients. The free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 screenshots.
Sign up for ScreenshotNeo’s free plan to try 1,000 screenshots a month with no card.
Frequently Asked Questions
What does Playwright return when I call page.screenshot() without a path?
It returns a Buffer containing the encoded screenshot image.
Can Playwright take a screenshot of an element rather than the whole page?
Yes. Use page.locator(selector).screenshot() to capture the locator’s bounds.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Does the screenshot API support WebP?
Yes. Set type: 'webp'; the default WebP quality is 100, which is lossless.
Quick Recap
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.

