October 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 ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk7 min

How to Take Website Screenshots with Playwright for QA Documentation

Use Playwright screenshots for bug evidence, component captures, test reports, and visual regression checks—with practical steps for making each image reproducible.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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

  1. 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.
  2. 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.
  3. Pick the scope. Save a viewport image for the visible screen, use fullPage when the whole scrollable page matters, or capture a locator when the component is the evidence.
  4. 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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
HP OmniBook 3 17.3 inch Laptop PC, FHD Display, AMD Ryzen 3 30, 8 GB RAM, 512 GB SSD, AMD Radeon 610M Graphics, Windows 11 Home, Mica Silver, 17-dp0199nr
  • FULL HD IPS DISPLAY - Enjoy vibrant, crystal-clear images with 178-degree wide-viewing angles
  • AMD RYZEN 3 30 PROCESSOR - Everyday performance you can count on; Multitask, stream, game casually, and edit photos smoothly with responsive power and vibrant HDR visuals
  • ENJOY UP TO 14 HOURS AND 15 MINUTES OF BATTERY LIFE - HP Fast Charge restores battery from 0 to 50% in approximately 45 minutes
  • AMD RADEON 610M GRAPHICS - Experience smooth entertainment; Built for streaming and multitasking, enjoy realistic visuals and efficient performance for work and play
  • STORAGE AND MEMORY - 512 GB PCIe NVMe M.2 SSD offers fast speed and efficient storage; and 8 GB LPDDR5 RAM memory boosts performance with higher bandwidth
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
HP 14" HD Chromebook Laptop for Students, Intel Quad-Core N4120(> N4020), 4GB RAM, 64GB eMMC, WiFi, Webcam, HDMI, USB-A&C, 14 Hours Battery Life, Zoom, Chrome OS, CUE Accessories
  • Intel Celeron N4120: 4 Cores & Threads, 1.1GHz Base Clock, Up to 2.6GHz Boost Clock, 4MB Cache, Intel UHD Graphics 600. The perfect combination of performance, power consumption, and value helps your device handle multitasking smoothly and reliably with four processing cores to divide up the work.
  • 14" HD Display: 14.0-inch diagonal, HD (1366 x 768), micro-edge, anti-glare. See your digital world in a whole new way. Enjoy movies and photos with the great image quality and high-definition detail of 1 million pixels.
  • Memory & Storage: 4 GB LPDDR4x & 64 GB eMMC Storage. Adequate high-bandwidth RAM to smoothly run multiple applications and browser tabs all at once. An embedded multimedia card provides reliable flash-based storage.
  • Ports:2 x USB 3.0 Type-A,1 x USB 3.0 Type-C,1 x HDMI,1 x Headphone Jack
  • Chrome OS: Chromebook is a computer for the way the modern world works, with thousands of apps. Enjoy the seamless simplicity that comes with Google Chrome and Android apps, all integrated into one laptop. It’s fast, simple, and secure.

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:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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
Sale
AKCHART 15.6'' AI Laptop with Office 365 12GB RAM 256GB SSD Win 11 Laptops
  • Stunning 15.6" FHD IPS Display: Experience crisp 1920x1080 resolution on this 15.6 inch laptop with an IPS panel that delivers wide viewing angles and vivid colors. The narrow-bezel design maximizes screen real estate for comfortable viewing on this Win 11 laptop, whether you're studying or working.
  • Celeron J4105 Processor & 256GB SSD: Powered by a reliable Celeron J4105 processor paired with 12GB DDR4 memory and a fast 256GB M.2 SSD. This laptop computer supports SSD expansion up to 2TB and TF card expansion up to 1TB, so your storage grows with your needs. Delivers smooth multitasking for daily productivity.
  • AI-Powered Win 11 Laptop: Built-in AI features enhance your productivity with smart assistance for writing, summarizing, and task management. Pre-installed with Win 11 and includes Office 365 subscription. This student laptop is backed by 1-year warranty and 24/7 customer support.
  • All-Day 7000mAh Battery & 180° Hinge: The high-capacity 7000mAh battery keeps this laptop powered through long classes or meetings. The 180-degree lay-flat hinge lets you share your screen effortlessly during presentations. This durable laptop computer adapts to your dynamic workflow.
  • Versatile Connectivity Hub: Equipped with USB 3.2, Type-C, Mini HDMI, and 3.5mm audio jack to connect all your peripherals. Stay online anywhere with high-speed 5G WiFi and Bluetooth 4.2. This college laptop keeps you connected at home, in the library, or on the go.

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.

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

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
HP Essential Laptop 2026, Intel CPU, 128GB Storage, Office 365, Windows 11
  • Efficient Performance for Everyday Computing: Powered by Intel N150 processor with up to 3.6 GHz Intel Turbo Boost Technology, 6 MB L3 cache, 4 cores, and 4 threads, this HP laptop delivers responsive performance for web browsing, streaming, document editing, and multitasking. Paired with 4GB LPDDR5 RAM and 128GB UFS storage, it handles daily tasks smoothly. Includes 1-year Microsoft 365 Personal subscription for Word, Excel, PowerPoint, and cloud storage to maximize your productivity.
  • 14-Inch HD Micro-Edge Display:Enjoy clear visuals on the 14-inch HD (1366 x 768) anti-glare screen with 250-nit brightness and 62.5% sRGB coverage. The micro-edge bezel delivers a 79% screen-to-body ratio in a compact design. An HP True Vision 720p HD camera with noise reduction and dual-array microphones supports clear video calls, remote work, and online learning.
  • Modern Connectivity and Wireless Technology: Stay connected with Wi-Fi 6 (2x2) for faster wireless speeds and Bluetooth 5.4 for seamless pairing with accessories. Versatile port selection includes 1 USB Type-C 10Gbps with DisplayPort 1.2 for external displays, 2 USB Type-A 5Gbps ports for peripherals, 1 HDMI 1.4b port, 1 headphone/microphone combo jack, and 1 multi-format SD media card reader. Connect monitors, transfer files quickly, and expand your workspace with ease.
  • All-Day Battery Life and Portable Design: Enjoy up to 11 hours of video playback, 7.5 hours of mixed usage, or 7.5 hours of wireless streaming on a single charge, perfect for students and professionals on the go. Weighing just 3.24 lb and measuring 12.76" x 8.86" x 0.71", this lightweight laptop fits easily in backpacks and bags. The stylish willow green top cover with matte finish and natural silver keyboard deck with vertical brushing pattern offer a modern, professional look.
  • AI-Enhanced Productivity: Access Microsoft Copilot instantly with the dedicated Copilot key for faster assistance. AI Noise Reduction filters background sounds and improves voice clarity during calls. Dual speakers provide clear audio, while the full-size natural silver keyboard and HP Imagepad support comfortable typing and navigation.

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.Support on Ko-Fi

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Sale
HP 14 inch Laptop, 2027 Edition, Intel N150 CPU, 4GB RAM, 128GB SSD, Copilot AI, 1TB Cloud Storage, Long Battery Life, Win 11 with Microsoft 365
  • 【Expansive Display】The 14 Non-touch display offers clear, and anti-glare coating, perfect for both work and entertainment.

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.

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

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.

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.

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

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.

More from the Wire

  1. Shenzhen desk3 min
    HONOR Expands Beyond Smartphones With Humanoid Robot RevealHONOR said it unveiled its first humanoid robot at MWC 2026 and named shopping assistance, workplace inspections, and supportive companionship as intended uses. Later Robotics D1 claims and a reported…
  2. Cupertino desk5 min
    Apple Unveils AirPods Max 2: The Upgrade That Should Have Happened Years AgoAirPods Max 2 adds H2-powered audio features and Apple claims up to 1.5× more effective ANC, but its design, Smart Case, and 20-hour battery rating are unchanged. Wired lossless audio…
  3. Cupertino desk4 min
    Apple’s OLED Touch MacBooks Are Coming—but the Dynamic Island Is the Real GambleApple has not announced an OLED touchscreen MacBook, but reports point to high-end models arriving in late 2026 or early 2027. The reported Mac Dynamic Island could be useful, but…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

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.