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

Use page.screenshot() with a clip rectangle to capture just part of a page. Set scale: 'css' if you want one output pixel per CSS pixel:

await page.screenshot({
  path: 'clip.png',
  clip: { x: 100, y: 80, width: 400, height: 250 },
  scale: 'css',
});

Define the clip rectangle

The clip option takes an object with four numeric fields. x and y locate the rectangle’s top-left corner; width and height set its dimensions. In the example above, the capture starts 100 pixels from the page’s left edge and 80 pixels from its top, and spans 400 by 250 pixels.

const clip = { x: 100, y: 80, width: 400, height: 250 };
await page.screenshot({ path: 'clip.png', clip, scale: 'css' });

The clip coordinates describe the capture region; they do not enable a separate “CSS clip” mode. Pixel density is controlled independently by scale.

Choose CSS pixels or device pixels

Playwright’s Page screenshot API defaults to scale: 'device'. A high-DPI device can therefore produce more output pixels than the rectangle’s CSS-pixel dimensions. Set scale: 'css' when you need one output pixel per CSS pixel, such as for predictable image dimensions. See the Playwright Page API for the option definitions.

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

Save an image or use the returned buffer

The path option is optional. With a path, Playwright saves the screenshot there and infers the image type from its extension. Without a path, page.screenshot() returns an image buffer for further processing or storage.

PNG is the default output format. The API also supports JPEG and WebP. JPEG’s documented default quality is 80; WebP quality 100 is lossless, while lower quality is lossy. Choose the format and quality based on whether you need lossless detail or a smaller file.

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.

Choose the right screenshot API

API or option Capture target Best suited to
page.screenshot({ clip }) An arbitrary rectangular region Saving a cropped page screenshot to a file or buffer
page.screenshot({ fullPage: true }) The full scrollable page Capturing beyond the currently visible viewport
Locator screenshot A particular element Capturing an element by its locator
expect(page).toHaveScreenshot({ clip }) A rectangle in a page screenshot Visual regression assertions in Playwright Test

fullPage and clip are documented as separate options. The API reference does not describe the behavior when they are combined, so check the documentation for your installed Playwright version rather than relying on a particular interaction.

Capture a specific element

Use a locator’s screenshot method when the target is an element rather than a rectangle chosen by page coordinates. Element capture waits for actionability and scrolls the element into view. Covered content will not become visible merely because it is captured, and a scrollable element shows only its currently scrolled content. Playwright discourages the ElementHandle screenshot method in favor of locator-based capture; see the ElementHandle API.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.

Compare a region against a visual baseline

For a visual regression test, use Playwright Test’s expect(page).toHaveScreenshot({ clip }). Its assertion waits for two consecutive screenshots to match before comparing the final capture with the expectation. This assertion requires the Playwright test runner. Its documented default animation behavior is disabled, unlike a direct Page screenshot, whose default is allow. See the PageAssertions API.

Make direct screenshots more repeatable

For captures used in tests or generated repeatedly, control visual changes that could alter the output:

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
  • Animations: Direct screenshots default to animations: 'allow'. Set animations: 'disabled' to stop CSS animations and transitions; finite and infinite animations are handled differently.
  • Caret: The direct screenshot API defaults to caret: 'hide'.
  • Page styling and masks: The API supports applying a stylesheet and masking matched locators when you need to control or obscure page content.

These controls affect the capture’s appearance; they do not change how the clip rectangle’s coordinates and dimensions are specified.

Troubleshoot common problems

  • The image dimensions are larger than expected: The Page screenshot default is device-pixel scale. Set scale: 'css' for one output pixel per CSS pixel.
  • The screenshot includes more than the target element: A clip rectangle captures a page region, not an element selected by CSS. Use a locator screenshot to target an element.
  • The saved image type is unexpected: When saving to a path, Playwright infers the type from the extension. Use a matching extension such as .png, .jpeg, or .webp.
  • The screenshot changes between runs: Animations are allowed by default for direct screenshots. Consider disabling them, and use the available stylesheet or masking options if changing page content is the source of variation.
  • You need a visual baseline check rather than just a file: Use expect(page).toHaveScreenshot({ clip }) in Playwright Test; the assertion API has its own animation defaults.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If you need a screenshot through an HTTP request instead of setting up Playwright, ScreenshotNeo provides a website screenshot API and MCP server. Its API captures a URL; the request below returns an image for https://stripe.com:

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.
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 accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks and 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 offers take_screenshot, get_page_info, and capture_pdf for AI agents. 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 get 1,000 screenshots a month 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.