Start with await page.goto(url). Playwright waits for the load event by default, which covers dependent resources such as stylesheets, scripts, iframes and images. For modern applications, that event is only a lifecycle boundary—not proof that the interface has finished fetching data or rendering. After navigation, wait for the specific heading, table, button or message your test needs.
What “completely loaded” means in Playwright
A browser page can continue changing after the load event. Single-page applications may hydrate components, request API data, render lazy content or start background work later. Playwright’s navigation guidance makes the important distinction: there is no universal moment at which every page is “loaded”; readiness depends on the page, framework and the action your test must perform.
Use two signals together:
- A navigation lifecycle state to establish that the document reached a known browser milestone.
- A locator assertion or other UI condition proving that the required application state is present.
For a normal navigation, the minimal reliable pattern is:
await page.goto('https://example.com');
await page.getByRole('heading', { name: 'Dashboard' }).waitFor();
The first line uses Playwright’s default load boundary. The second line waits for the outcome that matters to the test.
Crashes, 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 minuteWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstall#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
Choose the right waitUntil state
You can select the navigation boundary in page.goto() (and related navigation methods) with waitUntil. Each state answers a different question.
| State | What it means | Use it when |
|---|---|---|
commit |
The response was received and the document started loading. | You need very early synchronization, before the DOM is ready. |
domcontentloaded |
The browser fired DOMContentLoaded after parsing the document. |
The initial HTML is enough and images or other dependent resources are irrelevant. |
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 truly requires a quiet network. Playwright discourages it as a generic testing readiness check. |
Use the default load state
await page.goto('https://example.com', { waitUntil: 'load' });
Because load is already the default, omitting the option is equivalent:
await page.goto('https://example.com');
Use domcontentloaded for an earlier HTML checkpoint
await page.goto('https://example.com', { waitUntil: 'domcontentloaded' });
// The document is parsed; now wait for the exact element the test needs.
await page.getByRole('main').waitFor();
This can reduce unnecessary waiting when the test does not depend on images or other resources covered by load. It does not mean that the application’s data or interactive widgets are ready.
Treat networkidle as a narrow tool
await page.goto('https://example.com', { waitUntil: 'networkidle' });
networkidle waits for a 500 ms period with no network connections. Analytics, polling, advertisements, WebSockets and other background activity can prevent that quiet period or make it unrelated to user-visible readiness. For tests, prefer a locator tied to the required result instead of waiting for all traffic to stop.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Wait for the UI state your test actually needs
After navigation, assert the element that proves the application is ready for the next action. Locator actions and assertions auto-wait for the target to reach the required state, so an explicit sleep is usually unnecessary.
Wait for a heading, control or message
import { test, expect } from '@playwright/test';
test('report is ready', async ({ page }) => {
await page.goto('https://example.com/dashboard');
await expect(page.getByRole('heading', { name: 'Dashboard' })).toBeVisible();
await expect(page.getByRole('button', { name: 'Export' })).toBeEnabled();
await expect(page.getByRole('status')).toHaveText('Ready');
});
Choose a condition that represents usable state, not an implementation detail such as a spinner disappearing. A heading, enabled button, populated table or success message is generally a stronger contract.
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
Wait for data rendered into a table
await page.goto('https://example.com/orders');
await page.getByRole('heading', { name: 'Orders' }).waitFor();
await page.getByRole('table').waitFor();
await page.getByRole('row', { name: /Order 1001/ }).waitFor();
If the table can legitimately be empty, wait for the empty-state message instead of a row. The condition should describe both the data-present and data-absent outcomes your application supports.
Wait for a lazy-loaded section
await page.goto('https://example.com/profile');
const activity = page.locator('[data-testid="activity-list"]');
await activity.waitFor();
await expect(activity).toContainText('Recent activity');
This handles content that arrives after the initial document load. If the section is behind an interaction, perform that interaction and then wait for its resulting state.
Recommended Free Tools
Navigation triggered by clicks and other actions
Playwright normally waits for navigation and actionability as part of a click or similar action. If your test design needs a named lifecycle checkpoint, wait for it after the action:
await page.getByRole('button', { name: 'Open report' }).click();
await page.waitForLoadState('domcontentloaded');
await expect(page.getByRole('heading', { name: 'Report' })).toBeVisible();
The locator assertion remains the meaningful readiness check; the load-state call documents the intermediate browser milestone.
Popups and new pages
When an action opens a popup, capture the new page and then apply the same strategy to that page: choose an appropriate lifecycle boundary and wait for the popup’s required locator. Do not wait on the original page while expecting the popup’s DOM to change.
Frames
For an embedded frame, use the corresponding frame load-state method or, preferably, a locator scoped to that frame that represents the required content. A page-level load event does not establish that an independently loading frame has reached the state your test needs.
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 sleeps are unreliable
waitForTimeout() expresses elapsed time, not readiness. A delay can be too short on a busy run and unnecessarily slow on a fast run. It also hides the condition that makes the test correct. Replace it with a locator assertion, a response or URL condition that is directly tied to the user-visible result, or a deliberately selected navigation state.
// Fragile
await page.waitForTimeout(3000);
await page.getByRole('button', { name: 'Continue' }).click();
// Readiness-based
await page.getByRole('button', { name: 'Continue' }).waitFor();
await page.getByRole('button', { name: 'Continue' }).click();
A practical decision process
- Start with
page.goto(url). Keep the defaultloadstate unless the scenario has a documented reason to change it. - Identify the first action that follows navigation. Decide what visible element, state or message proves that action can succeed.
- Add a locator assertion or wait. Use roles, labels, text or stable test IDs that reflect the public UI contract.
- Use
domcontentloadedonly when earlier HTML is sufficient. Add a UI wait if application code still has to hydrate or fetch data. - Avoid generic
networkidle. Reserve it for a workflow where a 500 ms quiet period is itself the requirement. - Remove fixed sleeps. They do not adapt to real load variability.
- Make alternate outcomes explicit. If a page may show either rows or an empty-state message, wait for and assert the appropriate branch.
Performance and reliability considerations
Do not wait longer than the test’s contract
Waiting for load when only parsed HTML is needed adds resource work. Waiting for networkidle when a single heading is enough adds uncertainty. Select the smallest lifecycle boundary that supports the next step, then synchronize on the specific UI state.
Prefer stable, user-facing locators
Role- and label-based locators make the readiness condition understandable and resilient to internal markup changes. A stable test ID is useful when no accessible role or label represents the state. Avoid selectors that merely identify a loading implementation detail.
Keep the boundary explicit in shared helpers
If your project wraps navigation in a helper, let callers provide the readiness locator or assertion. A helper that always waits for networkidle can make every test slower and can hang on pages with continuous traffic.
Troubleshooting common failures
goto() returns, but the page is still rendering
Cause: the load event completed before a framework hydration step, lazy request or client-side render.
Fix: add an assertion for the heading, table, button, message or other state required by the next action. Do not assume a second arbitrary delay represents readiness.
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
A locator wait times out
Cause: the selector may be wrong, the element may be in a frame, the page may be on an unexpected URL, or the application may have taken an error or empty-data path.
Fix: verify the current URL and visible page state, scope the locator to the correct frame, and model the valid success and empty/error outcomes separately. Use a role or label that matches what a user can see.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
networkidle never arrives
Cause: polling, analytics, streaming connections or other ongoing requests keep the page from having no network connections for the required 500 ms.
Fix: replace it with a locator assertion or another condition tied to the intended result. Use the quiet-network state only when that quiet period is the actual requirement.
The test clicks before a control is usable
Cause: the control exists in the DOM but is not yet visible or enabled.
Fix: wait for the locator’s required state, or assert that it is visible and enabled, then click. Playwright’s locator actions perform their own actionability waiting.
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 opens a popup, but the wait is on the wrong page
Cause: the navigation occurred in a new page or frame.
Fix: capture the popup or target frame, then apply its load-state method and readiness locator there.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Or skip the browser setup
If your goal is a clean image or PDF rather than an end-to-end browser test, ScreenshotNeo provides a website screenshot API and MCP server. One GET request returns a PNG, JPEG, WebP or PDF; its capture options include waiting for a selector, a delay or network idle, along with full-page capture and lazy-image loading.
For example, the cURL request below captures Stripe as a WebP. See the ScreenshotNeo API documentation for parameters and response headers.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →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 accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups and chat widgets; each cleanup step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and each response identifies the page verdict and billing result with X-Page-Verdict and X-Billed headers. An MCP server exposes take_screenshot, get_page_info and capture_pdf to Claude, Cursor and other MCP clients.
The Free plan includes 1,000 screenshots per month with no card. Paid plans start at $5 for 3,000 screenshots; every feature is available on every plan. Sign up for the free plan to try it.
Frequently Asked Questions
What happens if I call waitForLoadState() after that state has already occurred?
It resolves immediately when the requested lifecycle state has already been reached, so it can be used as an explicit checkpoint without adding a second delay.
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.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Repair Windows errors before they cause bigger problems3Scan for outdated or missing drivers - takes under a minute

