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

Use a readiness condition that matches the page you are capturing. Navigate with an explicit waitUntil value, wait for a stable locator or assertion that proves the dynamic content is ready, then call page.screenshot() or locator.screenshot(). A browser load event only describes document loading; it does not prove that client-rendered data, hydration, or a transition has finished.

The reliable Playwright sequence

For a page whose report heading appears after rendering, gate the screenshot on that heading:

import { test, expect } from '@playwright/test';

test('capture the loaded report', async ({ page }) => {
  await page.goto('https://example.com/report', {
    waitUntil: 'domcontentloaded'
  });

  await expect(
    page.getByRole('heading', { name: 'Report' })
  ).toBeVisible();

  await page.screenshot({ path: 'report.png', fullPage: true });
});

domcontentloaded gets you to a parsed document quickly. The role-based assertion is the real application readiness gate. It retries until the heading is visible or the test timeout is reached, producing a useful failure when the page never reaches the expected state.

Choose page.screenshot() for a viewport or full-page image. Choose locator.screenshot() when only one component is required.

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.

Choose the navigation wait that fits the screenshot

page.goto() accepts a waitUntil option. Select the browser event that is necessary, then add an application-specific check when content is rendered asynchronously.

Setting What it proves Use it when What it does not prove
commit The response was received and loading started. You need the earliest navigation checkpoint and will gate readiness separately. It does not prove that HTML, images, or application data are ready.
domcontentloaded The initial document has been parsed. The structure is enough to begin and a locator/assertion will wait for rendered content. API-fetched data, hydration, images, and late UI updates.
load The browser load event fired after subresources considered part of the document loaded. The capture depends on ordinary page resources such as images and you still verify the visible state. Data fetched after load or a client-side route transition.
networkidle No network connections for at least 500 ms. Only in unusual, non-test automation where that heuristic is genuinely meaningful. Whether the business data is complete; polling and persistent connections can prevent or misrepresent idle.

Playwright’s Page API describes networkidle as “DISCOURAGED” for testing and recommends web assertions instead. A page can have no requests while still showing a skeleton, and a page with analytics polling may never become idle.

Gate on the content the image must contain

Wait for a visible heading, status, or table row

Use a stable, user-facing locator rather than a broad selector that can match a placeholder:

await page.goto('https://example.com/dashboard', { waitUntil: 'domcontentloaded' });

await expect(page.getByRole('heading', { name: 'Dashboard' })).toBeVisible();
await expect(page.getByRole('row', { name: /Revenue/ })).toBeVisible();
await expect(page.getByText('Updated just now')).toBeVisible();

await page.screenshot({ path: 'dashboard.png', fullPage: true });

Assertions are web-first: they retry and make the intended precondition explicit. Prefer text, roles, labels, or a dedicated test identifier that represents the completed state. Avoid matching a loading placeholder and the final element with the same generic class.

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

Use locator.waitFor() when an assertion is not needed

const chart = page.locator('[data-testid="sales-chart"]');
await chart.waitFor({ state: 'visible' });
await chart.screenshot({ path: 'sales-chart.png' });

locator.waitFor() defaults to visible and also supports attached, detached, and hidden. It is useful for a component whose presence or visibility is the exact condition you need, while an assertion is preferable when you also want to verify text or a value.

Wait for a loading indicator to disappear

await page.goto('https://example.com/report', { waitUntil: 'domcontentloaded' });
await page.locator('[data-testid="report-spinner"]').waitFor({ state: 'hidden' });
await expect(page.getByRole('heading', { name: 'Report' })).toBeVisible();
await page.screenshot({ path: 'report.png', fullPage: true });

Disappearance alone can be insufficient if an error state also removes the spinner. Pair it with a positive signal, such as the heading, a table row, or a success status.

When navigation follows a click

Playwright actions normally wait for actionability and the navigation they trigger. If you need a separate browser load checkpoint, wait after the navigation has committed:

await page.getByRole('link', { name: 'Reports' }).click();
await page.waitForLoadState('load');
await expect(page.getByRole('heading', { name: 'Reports' })).toBeVisible();
await page.screenshot({ path: 'reports.png', fullPage: true });

waitForLoadState() resolves immediately when the requested state has already been reached. It still does not replace the application-level assertion.

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.

Handling a client-side transition

Single-page applications may change the URL and content without a full document load. Wait for the destination content, not an event that may never fire:

await page.getByRole('button', { name: 'Open details' }).click();
await expect(page.getByRole('heading', { name: 'Order details' })).toBeVisible();
await expect(page.getByText('Order #')).toBeVisible();
await page.screenshot({ path: 'order-details.png', fullPage: true });

Full-page versus element screenshots

Full page

await page.screenshot({ path: 'page.png', fullPage: true });

This captures the page’s complete scrollable area after your readiness checks. If content loads as it enters the viewport, make sure your application has finished lazy loading before the capture; a visible final-state signal near the bottom can be more reliable than a timer.

One component

const invoice = page.getByTestId('invoice');
await expect(invoice).toBeVisible();
await invoice.screenshot({ path: 'invoice.png' });

locator.screenshot() performs actionability checks and scrolls the matched element into view. It throws if the element becomes detached, so locate the component again if the application replaces its DOM node during rendering.

Timeouts, diagnostics, and failure recovery

Keep the default timeout unless a known slow operation requires more time; then increase it for the specific assertion rather than masking every failure:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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
await expect(page.getByRole('heading', { name: 'Report' }))
  .toBeVisible({ timeout: 30_000 });
  • Blank screenshot: The capture ran before rendering. Replace a fixed sleep with a positive locator or assertion tied to the required content.
  • Missing API data: load or domcontentloaded fired before the fetch completed. Wait for the final table row, status text, or other user-visible result.
  • Assertion timeout: Check that the locator is unique and names the final state, then inspect the URL, authentication state, and application error message. A broad CSS selector may be matching a hidden skeleton.
  • Element detached: The framework replaced the node. Recreate the locator after rendering settles and avoid retaining an ElementHandle across updates.
  • networkidle never finishes: Background polling, WebSockets, or analytics can keep connections open. Remove that wait and assert on the content instead.
  • Images are absent: Use waitUntil: 'load' when ordinary image loading matters, then verify the image or its surrounding component. A successful load event still cannot prove that application data is complete.

For difficult failures, save a trace or diagnostic screenshot at the assertion point and log the current URL. The important question is which readiness condition failed, not how long an arbitrary delay ran.

Why fixed sleeps are a poor screenshot gate

await page.waitForTimeout(5000) may pass on a fast run and fail under load, while wasting five seconds when the page is already ready. It has no relationship to the state visible in the screenshot and gives no semantic failure message. A locator assertion adapts to variable latency and reports the missing condition.

If the page has several independent regions, wait for each region that must appear in the image:

await page.goto('https://example.com/analytics', { waitUntil: 'domcontentloaded' });
await expect(page.getByRole('heading', { name: 'Analytics' })).toBeVisible();
await expect(page.getByTestId('traffic-chart')).toBeVisible();
await expect(page.getByRole('row', { name: /Conversion rate/ })).toBeVisible();
await page.screenshot({ path: 'analytics.png', fullPage: true });
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Performance and reliability checklist

  • Use domcontentloaded plus assertions when the application controls readiness; use load when ordinary subresources are part of the visual contract.
  • Scope waits to the exact heading, row, status, or component that the screenshot must show.
  • Prefer role, label, text, test-id, or another stable selector over implementation-heavy CSS.
  • Do not use networkidle as a universal “finished” signal.
  • Capture only after navigation, transitions, and lazy content have reached their intended state.
  • Give slow, known operations a targeted timeout and preserve diagnostic context when they fail.

Or skip the browser setup

ScreenshotNeo provides a website screenshot API when you do not want to maintain Playwright navigation and wait logic. It accepts the cookie or consent banner like a visitor, then removes more than 60 known consent platforms, newsletter popups, and chat widgets before the capture; each cleanup step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers report the page verdict and whether the request was billed. Its MCP server exposes take_screenshot, get_page_info, and capture_pdf to Claude, Cursor, and other MCP clients.

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

See the ScreenshotNeo API documentation for all options, including full-page capture with lazy images, CSS-selector element capture, device and retina settings, custom CSS and JavaScript, click and wait conditions, request blocking, headers and cookies, timezone and geolocation, transparent backgrounds, resizing, chosen cache TTLs, signed links, asynchronous webhooks, bulk capture of up to 100 URLs per call, usage reporting, and the OpenAPI specification.

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.

One-call examples

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

There is a free allowance of 1,000 screenshots per month with no card. Paid plans start at $5 for 3,000 screenshots; every feature is included on every plan. If consent cleanup, non-billed failed captures, or an MCP workflow fits your use case, sign up for the free ScreenshotNeo plan.

Frequently Asked Questions

Does Playwright auto-wait before taking a screenshot?

Playwright auto-waits for actionability before actions, but screenshot correctness still depends on your page’s application state. Add an explicit assertion for the content that must appear in the image.

Can I wait for a specific API response instead of a locator?

A response wait can be useful when that response is the authoritative readiness signal, but verify the rendered result as well; receiving bytes does not guarantee that the UI has committed them.

Free tools Windows power users keep installed

One-click scans. No signup required.

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

What if the page contains several independently loading widgets?

Wait for one stable, positive signal per widget that the screenshot must include, then capture. This avoids treating an unrelated fast section as proof that every region is ready.

Which screenshot method should I use for a chart or card?

Use the component’s locator and locator.screenshot() after it is visible. Use page.screenshot({ fullPage: true }) for the complete scrollable document.

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.