October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk5 min

How to Take Screenshots of a Multi-Step Page Flow with Playwright

A reliable Playwright screenshot flow captures one named image per meaningful UI state, after an assertion confirms that state is ready.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Capture each meaningful page state separately: navigate to the start, perform one action, wait for an assertion that confirms the next state, then save a clearly named screenshot. Repeat for each step. For visual regression, use Playwright Test’s toHaveScreenshot() instead of treating saved images as comparisons.

Capture each state after the flow reaches it

A screenshot records what the page looks like at that moment; it does not advance the workflow. The default page.screenshot() captures the visible viewport. Use an ordered filename for every state so the images map back to the sequence.

As an Amazon Associate I earn from qualifying purchases.

This Playwright Test example illustrates a cart-to-payment flow. Replace the routes, accessible names, and assertions with those in your application. It is a documented-API pattern, not a test against a real checkout.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
import { test, expect } from '@playwright/test';

test('captures the checkout flow states', async ({ page }) => {
  await page.goto('/cart');
  await expect(page.getByRole('heading', { name: 'Your cart' })).toBeVisible();
  await page.screenshot({ path: 'artifacts/01-cart.png' });

  await page.getByRole('button', { name: 'Continue to delivery' }).click();
  await expect(page).toHaveURL(//delivery/);
  await expect(page.getByRole('heading', { name: 'Delivery' })).toBeVisible();
  await page.screenshot({ path: 'artifacts/02-delivery.png' });

  await page.getByRole('button', { name: 'Continue to payment' }).click();
  await expect(page).toHaveURL(//payment/);
  await expect(page.getByRole('heading', { name: 'Payment' })).toBeVisible();
  await page.screenshot({ path: 'artifacts/03-payment.png' });
});

The example assumes the project is configured to run Playwright Test and that its routes and headings match. The screenshot path’s parent directory must be available for the test’s output. See the Page API and locator guidance for the installed version’s details.

#1 Best Overall
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB | 1920×1080 LED Monitor, 4ms GtG, Adaptive Sync, HDMI 1.4, Tilt Adjust, Low Blue Light, 4yr Advance Replacement Warranty
  • CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
  • A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents

Wait for evidence of the next state

After each interaction, synchronize on something that proves the intended state is ready: a visible heading, a changed URL, or another meaningful UI condition. Locator actions wait for actionability, while Playwright assertions retry until they pass or time out. This is more reliable than assuming a fixed delay is enough.

  • For a content change, assert the new heading, dialog, or other visible element.
  • For a route change, use await expect(page).toHaveURL(//delivery/) or await page.waitForURL(...).
  • Do not use page.waitForTimeout() as routine synchronization. Playwright discourages timer-based waits in production tests; its API guidance says, “Never wait for timeout in production.”
  • Avoid networkidle as a general test-readiness signal; the Page API discourages it for tests. A page can still be visually unready after network traffic quiets, or remain active while the relevant UI is already ready.
  • waitForNavigation() is considered inherently racy; use waitForURL() when waiting for a URL transition.

These recommendations are documented in the Page API and Locators.

Choose viewport, full-page, or element capture

  • Viewport: await page.screenshot({ path: '02-delivery.png' }) captures what is visible in the current viewport.
  • Full scrollable page: await page.screenshot({ path: '02-delivery-full.png', fullPage: true }) captures the page’s full scrollable document at that state. It does not proceed to later steps in the flow.
  • One element: await page.locator('header').screenshot({ path: 'header.png' }) captures a component when the whole page is not needed.

Use full-page capture when the document’s complete length matters; use viewport capture when the screen presented at that interaction is the artifact you need. The Playwright Screenshots guide and Page API describe screenshot options.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB | 1920×1080 LED Monitor, 4ms GtG, Adaptive Sync, HDMI 1.4, Tilt Adjust, Low Blue Light, 4yr Advance Replacement Warranty
  • CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
  • SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors

Save artifacts, buffers, or report attachments

Providing path writes an image file. Without a path, page.screenshot() returns a buffer, which you can attach to a test report or pass to image-processing code.

To associate a screenshot with a named test step, capture the buffer inside test.step and attach it with the step’s attachment API:

await test.step('delivery details are ready', async (step) => {
  await expect(page.getByRole('heading', { name: 'Delivery' })).toBeVisible();
  const screenshot = await page.screenshot();
  await step.attach('screenshot', {
    body: screenshot,
    contentType: 'image/png',
  });
});

Playwright Test copies the attachment to a reporter-accessible location. See the TestStepInfo API. The attachment content type should reflect the image format you captured.

Rank #3
Sale
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
  • Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
  • Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
  • In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
  • Ultra-thin bezels: Maximize your viewing experience with thin bezels.

Use visual assertions for regression baselines

For visual regression, Playwright Test’s expect(page).toHaveScreenshot('step.png') compares the current rendering with a reference image. The assertion captures repeatedly until two consecutive screenshots match, then compares with the baseline. The first run creates the reference; later runs compare against it. This assertion requires the Playwright Test runner, not just the standalone Playwright library.

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.
import { test, expect } from '@playwright/test';

test('delivery screen matches its visual baseline', async ({ page }) => {
  await page.goto('/cart');
  await page.getByRole('button', { name: 'Continue to delivery' }).click();
  await expect(page.getByRole('heading', { name: 'Delivery' })).toBeVisible();
  await expect(page).toHaveScreenshot('02-delivery.png');
});

Keep approved reference images under version control and review baseline updates deliberately. Rendering can differ with operating system, browser version, settings, hardware, power source, and headless mode, so create and compare baselines in consistent runtime conditions. For unstable content, use supported screenshot controls such as masks or a custom stylesheet where appropriate. Consult Visual comparisons and the PageAssertions API for current options.

Troubleshoot missing or unreliable screenshots

  • The image shows the previous step: the transition may not have finished when capture ran. Add an assertion for the next state’s visible content or URL before taking the image.
  • The test waits too long or flakes intermittently: replace fixed sleeps or a general network-idle wait with a locator assertion or URL expectation tied to the state you need.
  • The URL assertion never passes: check the application’s actual route and whether the action causes a URL change at all. For an in-page transition, assert the changed UI instead.
  • The image contains the wrong amount of page: default capture is the viewport; set fullPage: true for the full scrollable document, or use a locator screenshot for a component.
  • A visual baseline changes across machines: compare in a consistent browser and runtime environment, and review dynamic content handling before accepting a new reference.
  • The visual assertion is unavailable: confirm the test runs under Playwright Test, which provides toHaveScreenshot().

Or skip the browser setup

If you need a rendered website image without writing a Playwright flow, ScreenshotNeo provides a screenshot API and MCP server. One GET request can return an image or PDF; for a basic WebP capture:

Rank #4
Sale
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor | 100Hz, Game Mode, Advanced Eye Comfort, HDMI and D-sub Ports (LS27D366GANXZA)
  • CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
  • SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
  • MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
  • KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
  • INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient

See the ScreenshotNeo documentation for API details and 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/consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before the shot; each of those steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers identify the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients. The Free plan includes 1,000 shots per month without a card; paid plans start at $5 for 3,000 shots.

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

Sign up for ScreenshotNeo’s free plan to get 1,000 screenshots a month with no card.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Frequently Asked Questions

Can I take screenshots of several steps without reopening the page?

Yes. Keep the same Playwright page open, interact with it to reach each state, and save an image after each state is ready.

Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
  • 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
  • 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.

Does `fullPage: true` capture every step in a flow?

No. It captures the full scrollable document for the current state only.

Can I use `toHaveScreenshot()` with plain Playwright?

No. `toHaveScreenshot()` is provided by Playwright Test.

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.

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. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

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.