Use Playwright’s page.screenshot() for a one-off QA image, fullPage: true for a full-page record, and a locator’s screenshot() to isolate a component. For recurring visual regression checks, use Playwright Test’s expect(page).toHaveScreenshot() so the image is compared with a reviewed baseline. The key to useful documentation is capturing a deliberate, reproducible UI state—not merely taking a picture of whatever happens to be on screen.
Choose the right Playwright capture
| QA need | Playwright method | What it gives you |
|---|---|---|
| One-time bug report or QA artifact | page.screenshot({ path }) |
Saves an image of the current page viewport. It does not compare the image with an expected result. |
| Long-page documentation | page.screenshot({ path, fullPage: true }) |
Captures the full scrollable page in one image. |
| Specific component or error | locator.screenshot({ path }) |
Captures the matched element rather than the whole page. |
| Visual regression test | expect(page).toHaveScreenshot() |
Compares a stabilized screenshot with a maintained visual baseline in Playwright Test. |
| Test report evidence | page.screenshot() plus step.attach() |
Attaches an image buffer to a named test step for reporters. |
Capture a reproducible QA state
- Set up the state under test. Navigate to the relevant route, sign in or seed test data if needed, and perform the action that reveals the issue.
- Wait for a meaningful condition. Use a locator assertion or other deliberate synchronization for the UI you need to document. Avoid substituting an arbitrary sleep for identifying when the relevant state is ready.
- Pick the scope. Save a viewport image for the visible screen, use
fullPagewhen the whole scrollable page matters, or capture a locator when the component is the evidence. - Make the artifact identifiable. Use a filename that identifies the test or state, such as
checkout-error.png, and retain it with the QA report or test output.
Save a viewport or full-page screenshot
In a Playwright test, path writes the captured image to a file. The default screenshot format is PNG; WebP can be selected by using a filename ending in .webp. The documented PNG and WebP formats are lossless.
import { test } from '@playwright/test';
test('capture checkout error for QA', async ({ page }) => {
await page.goto('/checkout');
await page.getByRole('button', { name: 'Place order' }).click();
await page.getByRole('alert').waitFor();
await page.screenshot({ path: 'artifacts/checkout-error.png' });
await page.screenshot({
path: 'artifacts/checkout-full-page.png',
fullPage: true,
});
});
The first image records the viewport at the point of capture. The second covers the full scrollable page, which can be useful for documenting a long form or page layout. A full-page artifact can be unwieldy when the issue is confined to one screen or component, so choose it only when below-the-fold context is relevant.
Capture a component instead of the whole page
Use a locator screenshot when a specific alert, panel, or widget is the evidence. Locator-based capture avoids unrelated page areas; the older ElementHandle screenshot approach is discouraged in favor of locators.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →#1 Best Overall
- 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.
await page.getByRole('alert').screenshot({
path: 'artifacts/checkout-alert.png',
});
Prefer a semantic locator such as a role and accessible name where one matches the target. If the locator does not resolve uniquely or the element is not in a capturable state, refine the locator or wait for the condition that makes the intended component available.
Attach a screenshot to a Playwright test step
When evidence should travel with a test report rather than live only as a loose file, capture a buffer and attach it to a named step. The attachment API copies the image to a location accessible to reporters after the call completes.
import { test } from '@playwright/test';
test('checkout displays an error', async ({ page }) => {
await page.goto('/checkout');
await page.getByRole('button', { name: 'Place order' }).click();
await test.step('capture validation state', async step => {
const screenshot = await page.screenshot();
await step.attach('checkout-validation', {
body: screenshot,
contentType: 'image/png',
});
});
});
This keeps a named screenshot associated with the test step in reporter output, which is often easier to inspect alongside the action that produced the state.
Rank #2
- 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.
Use visual assertions for recurring regression checks
A saved image is evidence of one run; it is not itself a pass/fail comparison. For a maintained visual regression test, use Playwright Test’s screenshot assertion:
Recommended Free Tools
import { test, expect } from '@playwright/test';
test('checkout visual layout', async ({ page }) => {
await page.goto('/checkout');
await expect(page.getByRole('heading', { name: 'Checkout' })).toBeVisible();
await expect(page).toHaveScreenshot('checkout.png');
});
The assertion waits for two consecutive screenshots to match before comparing the result with the expectation. On its first run, Playwright creates a reference screenshot; review it before adding it as the intended baseline. When a later UI change is intentional, review the difference and update snapshots deliberately, for example with --update-snapshots, rather than treating every changed image as correct by default.
Reduce noise without hiding the bug
Control animation
Direct screenshot capture allows animations by default, while screenshot assertions disable animations by default. If motion adds irrelevant variation to a one-off artifact, set animations: 'disabled' on the direct screenshot. Playwright fast-forwards finite animations and cancels infinite ones for the capture, then resumes them afterward. For assertions, the default already disables animations.
Rank #3
- 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.
Mask dynamic or sensitive areas
Locator masks cover matched elements’ bounding boxes; the default mask color is pink. A mask can help when a timestamp or changing user detail distracts from the defect, but it can also conceal relevant behavior. Use it narrowly and keep sensitive data out of artifacts where possible.
Hide or normalize volatile content with styles
Screenshot capture supports a style option, and visual assertions support stylePath, for temporary CSS that hides or changes content during capture. Restrict these styles to genuinely irrelevant variation so the artifact still represents the behavior being documented.
Choose image scale intentionally
The scale option can produce one image pixel per CSS pixel with 'css', or capture device pixels with 'device'. Device-pixel output can be larger, so choose it based on whether the QA record needs the extra density.
Rank #4
- 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
Keep screenshot comparisons reliable
Rendered pixels can differ with operating system, browser version, settings, hardware, power source, and headless mode. Generate baselines and compare them in a consistent environment. If the project deliberately tests platform-specific rendering, maintain separate expectations for the relevant browser or platform rather than treating environmental differences as product regressions.
- Pin and use the project’s intended browser and Playwright setup for baseline generation and comparison.
- Make test data and the UI state deterministic before capturing.
- Use the right viewport and scale for the behavior being checked.
- Review baseline changes as code changes; regenerate only for an intentional UI change.
Playwright’s options and defaults can change between releases. Check the official documentation for the version pinned by your project when a particular option or default matters.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Troubleshoot common screenshot problems
The screenshot shows a loading state or misses the error
Cause: capture ran before the relevant UI state appeared. Fix: wait for a locator or assertion tied to the actual state, such as the alert or heading, and ensure the action that should reveal it has completed. Avoid relying on a guessed delay.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Best Value
- 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.
A full-page image is too tall or hard to review
Cause: the issue occupies only a small part of a long page. Fix: use a viewport capture for screen-level context or a locator screenshot for the component, reserving fullPage for cases where the complete scrollable layout matters.
Visual assertions fail intermittently
Cause: dynamic content, animation, or environment differences produce changing pixels. Fix: stabilize the page state, mask or normalize only irrelevant volatile areas, and run comparisons in a consistent environment. Do not hide content that could contain the regression being tested.
The image differs from the expected device density
Cause: capture scale does not match the desired CSS-pixel or device-pixel output. Fix: set scale to 'css' or 'device' according to the artifact’s purpose, and keep the setting consistent for comparisons.
A changed baseline is treated as a passing fix
Cause: a reference image was updated without reviewing what changed. Fix: inspect the image diff and confirm that the UI change is intended before using --update-snapshots.
Or skip the browser setup
If you need a website screenshot without setting up a Playwright browser run, ScreenshotNeo offers a one-request capture through its website screenshot API. It accepts common screenshot API parameter names and can return PNG, JPEG, WebP, or PDF. See the ScreenshotNeo documentation for request options.
curl -G "https://api.screenshotneo.com/v1/shot"
-d access_key=YOUR_API_KEY
--data-urlencode url=https://stripe.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 these steps can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed; response headers report the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. The free plan includes 1,000 screenshots per month with no card required; paid plans start at $5 for 3,000 screenshots.
Sign up for ScreenshotNeo and get 1,000 free screenshots a month, with no card.
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.




