Wait for the specific content your screenshot needs—not just for navigation to finish. In Playwright, navigate with page.goto(), wait for an application-specific signal such as a visible locator, then capture the viewport, full page, or target element.
Wait for the content the screenshot must show
A navigation event tells you that a document reached a particular loading milestone. It does not prove that a JavaScript-driven report, widget, or image has rendered. Define readiness using the page content you need in the image.
In a Playwright test, a web-first assertion is a practical way to wait for a visible element. This complete JavaScript example waits for a report heading before taking a full-page screenshot:
import { chromium, expect } from '@playwright/test';
const browser = await chromium.launch();
const page = await browser.newPage();
try {
await page.goto('https://example.com');
await expect(
page.getByRole('heading', { name: 'Loaded report' })
).toBeVisible();
await page.screenshot({ path: 'page.png', fullPage: true });
} finally {
await browser.close();
}
Replace the example URL and heading with values for your application. The locator should represent the actual content or state that must appear in the screenshot; a heading that renders before the data you need is not a sufficient readiness condition.
#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.
Outside a test
If you are not using Playwright Test’s expect, wait for the relevant locator or another explicit application signal before capturing. For example:
await page.goto('https://example.com');
await page.locator('.report-ready').waitFor({ state: 'visible' });
await page.screenshot({ path: 'page.png' });
Use a selector or signal that your application actually exposes. Where the required content is identified by text, a role, a response, or a readiness flag, wait for that condition instead of guessing how long rendering will take.
Choose the right navigation milestone
page.goto() supports navigation wait conditions including commit, domcontentloaded, load, and networkidle. domcontentloaded corresponds to the document’s DOMContentLoaded event; load corresponds to its load event. These milestones describe navigation, not whether a particular asynchronous component has finished rendering.
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.
networkidle means there have been no network connections for at least 500 ms. Playwright labels it discouraged for testing and advises: “Don’t use this method for testing, rely on web assertions to assess readiness instead.” That guidance is specifically about using networkidle as a testing wait condition. See the Playwright Page API documentation.
For a screenshot, the deciding question is not simply whether the page is quiet; it is whether the required content is ready. A live page may continue making requests after the relevant content appears, while a page can be network-idle before a delayed component has rendered.
Capture the viewport, full page, or one element
Choose the capture extent based on what the image needs to contain. Playwright’s default page screenshot is the current viewport; fullPage defaults to false.
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.
| Capture target | Example | When to use it |
|---|---|---|
| Current viewport | await page.screenshot({ path: 'page.png' }); |
Capture what is currently visible in the browser viewport. |
| Full scrollable page | await page.screenshot({ path: 'page.png', fullPage: true }); |
Capture the page as though its full scrollable document fit on a tall screen. |
| One element | await page.locator('.report').screenshot({ path: 'report.png' }); |
Capture a particular component rather than the whole page. |
| Image bytes | const bytes = await page.screenshot(); |
Return screenshot bytes for post-processing or passing to another tool instead of writing a file. |
The examples and screenshot behavior are documented in the Playwright screenshots guide and screenshot options reference.
Control animation and other visual details
Screenshot options can disable animations, set a clip region, or control caret appearance. Consult the Page API reference for the options available in the Playwright version installed in your project.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Animation handling changes the visual state of the capture; it does not establish that JavaScript data has loaded. The API documentation describes finite animations as fast-forwarded and infinite animations as canceled to their initial state, then played after the screenshot. Keep readiness checks separate from visual consistency settings.
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
Or skip the browser setup
ScreenshotNeo can return a screenshot or PDF with one GET request. Its API documentation covers request options.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
Cookie banners are accepted and removed before capture, along with known newsletter popups and chat widgets; each cleanup step 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. An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents. The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots.
Sign up free for 1,000 screenshots a month—no card required.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Troubleshoot screenshots that look incomplete
- The screenshot is blank or missing report data: Navigation may have completed before the application rendered its content. Wait for a locator or application signal tied to the missing content.
- The wait never completes: Check that the selector exists on this page and that the expected state can occur. A selector for a different route, or a state the application never reaches, cannot establish readiness.
- The screenshot cuts off content below the fold: The default is a viewport capture. Set
fullPage: truewhen you need the full scrollable page. - The full-page image still lacks content that appears on scroll: Make sure the relevant content has actually been rendered before capture; full-page extent is not a substitute for an application-specific readiness condition.
- The result differs because of animation or a blinking caret: Use the relevant screenshot options for animation or caret handling, and verify the current API reference for your installed version.
- A fixed delay appears to work inconsistently: Elapsed time does not verify that the needed component rendered. Replace a general timeout with a locator, response, or explicit readiness signal when one is available.
FAQ
Does page.goto() wait for JavaScript to finish?
No single navigation milestone proves that every application-specific JavaScript task has finished. Wait for the particular content your screenshot needs.
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.
Does fullPage: true wait for lazy-loaded images?
It controls the capture extent, not whether your application has finished rendering required content. Establish readiness separately.
Can I use the screenshot without saving a PNG file?
Yes. Calling page.screenshot() without a path returns screenshot bytes, which you can pass to another tool or process in memory.
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.

