Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
Use await page.goto(url) for a normal navigation, then wait for the UI state your test actually needs. Playwright waits for the load event by default, but that event cannot prove that a modern application has finished fetching data, rendering lazy content, or becoming interactive. Select a lifecycle boundary with waitUntil when appropriate, and prefer locator assertions for application readiness.
What Playwright waits for by default
A basic navigation is:
import { chromium } from 'playwright';
const browser = await chromium.launch();
const page = await browser.newPage();
await page.goto('https://example.com');
// The default waitUntil value is 'load'.
await browser.close();
page.goto() resolves at the browser’s load event unless you choose another state. The load event includes dependent resources such as stylesheets, scripts, iframes and images. It is a useful general boundary, not a guarantee that every application task is complete.
Playwright’s navigation guidance makes the important qualification explicit: there is no universal definition of a page being “loaded”; readiness depends on the page and framework. A single-page app may continue making API requests after load, while a server-rendered page may be ready as soon as its HTML is parsed.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Choose the right navigation lifecycle state
| State | What it means | Use it when |
|---|---|---|
commit |
The response has been received and the document has started loading. | You need the earliest navigation synchronization, such as observing an immediate URL or document change. |
domcontentloaded |
The browser fired DOMContentLoaded after parsing the document. |
Your test needs the initial DOM quickly and does not depend on images or other load-event resources. |
load |
The browser fired load; dependent resources such as stylesheets, scripts, iframes and images have loaded. |
General navigation completion. This is goto()‘s default. |
networkidle |
No network connections for at least 500 ms. | Only a specific non-test workflow requires a quiet network. Playwright discourages it as a generic testing readiness check. |
For example, explicitly selecting the default:
await page.goto('https://example.com', { waitUntil: 'load' });
To reach parsed HTML sooner:
await page.goto('https://example.com', { waitUntil: 'domcontentloaded' });
networkidle is often the wrong answer. Analytics, polling, WebSockets, advertisements and background refreshes can keep a page busy indefinitely, or make a 500-ms quiet period occur before the data you need arrives. If you use it, do so because the particular non-test operation requires that boundary—not because “complete” sounds reassuring.
#1 Best Overall
- 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 the state your test needs
After navigation, express readiness as an observable UI condition. Locator assertions automatically wait for the target to reach the required state and retry until the assertion timeout.
import { test, expect } from '@playwright/test';
test('dashboard is ready', async ({ page }) => {
await page.goto('/dashboard');
await expect(page.getByRole('heading', { name: 'Dashboard' })).toBeVisible();
await expect(page.getByRole('table')).toBeVisible();
});
This is stronger than waiting an arbitrary number of milliseconds: it proves that the heading and table are visible, which are the conditions needed by the test. Choose a stable, user-visible signal such as:
- A heading identifying the loaded screen.
- A table row containing data returned by the page.
- A button becoming enabled.
- A loading indicator disappearing.
- A success, error or empty-state message that the test explicitly handles.
Prefer role, label and text locators over brittle CSS paths. If a page can legitimately show an empty result, assert the empty state as an alternative rather than waiting forever for a row that will never exist.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Waiting for a specific data result
await page.goto('/orders');
await expect(page.getByRole('status')).toHaveText('Orders loaded');
await expect(page.getByRole('row', { name: /Order #1042/ })).toBeVisible();
If the application has no accessible readiness signal, add one in the application (for example, a status element with an appropriate role) rather than replacing the test with a fixed sleep. A deterministic DOM contract makes failures diagnosable.
When navigation follows a click
Playwright actions wait for actionability, and navigation triggered by a click is handled as part of normal behavior. Write the action directly:
await page.getByRole('button', { name: 'Open report' }).click();
await expect(page.getByRole('heading', { name: 'Report' })).toBeVisible();
If the test design requires an explicit lifecycle checkpoint, call waitForLoadState() after the action:
Rank #2
- 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
await page.getByRole('button', { name: 'Open report' }).click();
await page.waitForLoadState('domcontentloaded');
await expect(page.getByRole('heading', { name: 'Report' })).toBeVisible();
If the requested state has already been reached, waitForLoadState() resolves immediately. Do not add it automatically after every action; the locator assertion usually supplies the meaningful synchronization.
Avoiding a race between a click and navigation
When you need the destination response itself, start waiting before the click:
const navigation = page.waitForURL('**/report');
await page.getByRole('button', { name: 'Open report' }).click();
await navigation;
await expect(page.getByRole('heading', { name: 'Report' })).toBeVisible();
The URL wait confirms routing, while the heading assertion confirms that the destination UI is usable. Keep both only when both facts matter.
Popups, frames and other documents
Popup pages
Capture a popup while triggering it, then apply the same readiness rule to the new page:
const popupPromise = page.waitForEvent('popup');
await page.getByRole('link', { name: 'Preview' }).click();
const popup = await popupPromise;
await popup.waitForLoadState('domcontentloaded');
await expect(popup.getByRole('heading', { name: 'Preview' })).toBeVisible();
Frames
Locate the frame and wait for content inside that frame. A frame has its own document lifecycle:
const report = page.frameLocator('#report-frame');
await expect(report.getByRole('heading', { name: 'Report' })).toBeVisible();
The locator assertion waits for the frame content needed by the test, avoiding a global sleep.
Rank #3
- 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.
Why fixed delays fail
page.waitForTimeout(5000) encodes elapsed time, not readiness. A five-second delay can still be too short on a slow CI worker and wastes four seconds when the page is ready immediately. It also hides the condition that failed. Replace it with a locator assertion, URL wait, response wait, or an application-specific state.
If a third-party widget is irrelevant, do not wait for it. If it blocks the control under test, isolate or stub it in the test environment. Waiting for every request made by a page couples your test to analytics and vendor behavior.
A complete, resilient example
import { test, expect } from '@playwright/test';
test('user can download a completed report', async ({ page }) => {
await page.goto('https://app.example.test/reports', {
waitUntil: 'domcontentloaded',
});
await expect(page.getByRole('heading', { name: 'Reports' })).toBeVisible();
await expect(page.getByRole('status')).toHaveText(/ready/i);
const downloadPromise = page.waitForEvent('download');
await page.getByRole('button', { name: 'Download report' }).click();
const download = await downloadPromise;
await expect(page.getByRole('status')).toHaveText(/download started/i);
await download.saveAs('artifacts/report.csv');
});
Here, domcontentloaded avoids waiting for unrelated images, while the status and heading establish that the application is ready. The download event is synchronized independently because it is not a page-load event.
Timeouts, failures and troubleshooting
“Navigation timeout exceeded”
Cause: the server, a redirect chain or a resource did not finish before the navigation timeout.
Fix: inspect the failing URL and server logs first. Confirm that the test environment is reachable, then set a justified timeout for this navigation:
await page.goto(url, { waitUntil: 'load', timeout: 60_000 });
Do not mask an outage with an extremely large timeout. A timeout should leave enough time for expected CI variance while still failing a broken dependency.
Rank #4
- 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
The page is visible but assertions time out
Cause: the assertion targets the wrong role or name, data is still loading, or the application rendered an error or empty state.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteFix: inspect the DOM and accessibility tree, assert the loading/error states explicitly, and use a stable locator. If the data arrives through an API, wait for the resulting UI rather than a guessed delay.
networkidle never resolves
Cause: polling, WebSockets, analytics or another long-lived request prevents 500 ms of silence.
Fix: remove networkidle and wait for the heading, row, button or status that proves readiness. Reserve network idle for a narrowly defined non-test operation.
Images or lazy content are missing
Cause: lazy loading may occur only after scrolling or after an element enters the viewport; the load event does not imply that future lazy requests have completed.
Fix: scroll the relevant element into view and assert its loaded state or visible dimensions. For visual capture, wait for the actual image or component selector rather than the global page lifecycle.
Best Value
- 【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.
A click races with a route change
Cause: the test starts observing navigation after the click has already initiated it.
Fix: create the URL, popup or response wait before the action, then assert the destination UI.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Performance and reliability guidelines
- Use
domcontentloadedwhen dependent resources are irrelevant; otherwise keep the defaultload. - Wait for one or two meaningful readiness signals instead of every request on the page.
- Use stable semantic locators and application-owned status elements.
- Keep navigation, API-response, download and popup waits separate so a failure identifies the missing event.
- Set timeouts close to expected behavior and investigate slow environments instead of hiding them.
- For screenshots or PDFs, explicitly wait for the component, image or font condition that affects the output.
Or skip the browser setup
If your goal is a clean screenshot rather than a browser test, ScreenshotNeo provides a one-request API. It accepts cookie and consent banners as a visitor, then removes more than 60 known consent platforms, newsletter popups and chat widgets before capture; each cleanup step can be turned off. Only clean shots are billed: bot checks or CAPTCHAs, blank pages, timeouts, failed loads and cache hits cost nothing, and response headers report the page verdict and billing status.
Recommended Free Tools
Use the API documentation at https://screenshotneo.com/docs/ for all options, including waits for a selector, delay or network idle.
cURL
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Python
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)
Node.js
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
ScreenshotNeo also offers an MCP server with take_screenshot, get_page_info and capture_pdf tools for Claude, Cursor and other MCP clients. It supports full-page captures with lazy images loaded, CSS-selector element shots, dark mode, device presets, custom viewports, retina scale, PDF controls, custom CSS and JavaScript, clicks before capture, selector hiding, request blocking, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, chosen cache TTLs, signed image links, asynchronous signed webhooks, bulk capture of up to 100 URLs per call, usage reporting and an OpenAPI specification. Parameters used by other screenshot APIs also work for easier migration.
The Free plan includes 1,000 shots each month with no card. Paid plans start at $5 for 3,000 shots; every feature is available on every plan. Create a free ScreenshotNeo account.
Frequently Asked Questions
Does Playwright wait for fonts to finish loading?
The navigation lifecycle alone is not a reliable font-readiness contract. If font rendering matters, wait for the component whose final appearance you verify, or expose an application-specific readiness signal.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Can I combine a lifecycle state with a locator assertion?
Yes. Select the earliest useful navigation boundary, then assert the visible heading, data row, control or state that proves the page is ready for the scenario.
What should a test do when a page can be either successful or empty?
Model both valid outcomes with explicit assertions, such as a data-row branch and an empty-state message, instead of waiting indefinitely for data.
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.

