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

Choose the Puppeteer wait that matches the condition your code needs: use waitForSelector() for an element’s DOM or visibility state, waitForFunction() for a custom page-side condition, a locator for an action that should wait until it is ready, and waitForNavigation() when an action navigates. These waits are not interchangeable.

Choose the right Puppeteer wait

API What it waits for Use it when Important caveat
page.waitForSelector() A selector to enter or leave the DOM; optionally become visible or hidden You know the selector for the state you need Presence alone does not mean an element is ready to interact with.
page.waitForFunction() A predicate in the page context to return a truthy value The needed state is application-specific and not covered by a selector wait Pass Node.js values as arguments; the browser callback cannot access Node variables by closure.
page.locator() Element presence and, for actions, the required action preconditions Your goal is to interact with an element Locator waits and actions have their own timeout and behavior.
page.waitForNavigation() A navigation or qualifying URL change A click or other action is expected to navigate Start the wait before triggering the action.

The current Puppeteer API references used here are versioned 25.12.0, retrieved October 3, 2026, except the Frame selector reference, which is version 25.10.0. Check the documentation for the version installed in your project if behavior or examples differ.

Wait for an element to appear, become visible, or disappear

Wait for DOM presence

page.waitForSelector() resolves immediately if the selector already matches; otherwise, it waits for a matching element to be added to the DOM. The default wait checks presence, not visibility. It returns an element handle when found.

const result = await page.waitForSelector('.result', { timeout: 10_000 });

In the example, the timeout is 10 seconds. Selector waits default to 30 seconds. Set a task-specific timeout, change the page default with page.setDefaultTimeout(), or set timeout: 0 to disable the timeout. Selector wait options also accept an AbortSignal for cancellation. If the selector is still missing after the configured timeout, the wait throws.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • 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 visibility or hidden state

await page.waitForSelector('.result', { visible: true });
await page.waitForSelector('.spinner', { hidden: true });

For visible: true, Puppeteer requires the element to be in the DOM and not have display: none or visibility: hidden. That does not guarantee it is enabled, stable, or unobstructed. With hidden: true, the wait resolves when the selector is absent or hidden; if no matching element exists, it resolves to null.

Wait for a custom page condition

Use page.waitForFunction() when the condition is a page-side predicate rather than a simple selector state—for example, when a minimum number of rows must render.

Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • 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.waitForFunction(() => document.querySelectorAll('.row').length >= 3);

The callback runs in the page context until its result is truthy. Values from Node.js must be passed as additional arguments:

const selector = '.foo';
await page.waitForFunction(
  selector => !!document.querySelector(selector),
  {},
  selector,
);

Keep the predicate focused on the state the next step actually needs. Waiting for a real condition avoids relying on an arbitrary delay that may be too short on a slow run and unnecessarily long on a fast one.

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

Wait until an element is ready for an action

When the goal is to click or otherwise interact with an element, Puppeteer recommends locators. A locator action waits for the element to be present and checks action preconditions such as viewport position, visibility, enabled state, and—before a click—a stable bounding box. This is more appropriate than treating waitForSelector({ visible: true }) as proof that an element is actionable.

await page.locator('button').click();

You can also wait on a locator without performing an action:

Rank #4
Sale
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • 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
await page.locator('.loading').wait();

For the official guide to locator interactions, see Puppeteer’s Page interactions guide; API details are in the Page.waitForSelector reference.

Wait for navigation after a click

Start the navigation wait before the click. If you await the click first and only then begin waiting for navigation, the navigation event may already have happened.

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.
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.
const [response] = await Promise.all([
  page.waitForNavigation(),
  page.click('a.my-link'),
]);

You can use a locator click as the triggering action while keeping the same ordering:

const [response] = await Promise.all([
  page.waitForNavigation(),
  page.locator('a.my-link').click(),
]);

The navigation wait defaults to a 30-second timeout and to waitUntil: 'load'; its options are distinct from selector-wait options. Puppeteer also treats qualifying History API URL changes as navigation. A client-rendered update that does not navigate is better handled by a selector or page predicate. See the Page.waitForNavigation reference.

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

Understand frame and element-handle wait behavior

If navigation may replace the document, choose the wait context deliberately. Frame.waitForSelector() works across navigations. By contrast, ElementHandle.waitForSelector() is scoped to the current element; it does not work across navigation or if that element detaches. Use the page or frame method when the document may be replaced. The Frame API reference cited here is version 25.10.0; consult the reference matching your installed version.

Troubleshoot common wait failures

Selector wait times out

  • Cause: The selector does not match, or the element appears after the timeout.
  • Fix: Confirm the selector and the state being awaited. Increase the task-specific timeout if the page legitimately needs longer, or set the page default with page.setDefaultTimeout(). Disable a selector timeout with timeout: 0 only when an unbounded wait is appropriate.

The element exists, but the wait does not establish that it is visible

  • Cause: The default selector wait checks DOM presence only.
  • Fix: Add { visible: true } or use { hidden: true } for the inverse state. If the next step is an interaction, prefer a locator action for its actionability checks.

The click happens, but the navigation wait misses the event

  • Cause: The navigation wait was started after the click.
  • Fix: Start both together with Promise.all([page.waitForNavigation(), clickAction]).

A selector wait stops working after navigation or detachment

  • Cause: The wait is attached to an element handle that was replaced or detached.
  • Fix: Use page.waitForSelector() or frame.waitForSelector() instead when the wait must survive navigation.

A wait condition is not reachable from the callback

  • Cause: A waitForFunction() callback executes in the browser page context, not in Node.js.
  • Fix: Pass required values as arguments to waitForFunction(), as in the selector example above.

Or skip the browser setup

If you need screenshots rather than browser automation, ScreenshotNeo is a website screenshot API and MCP server. Its one-call API captures a URL as an image or PDF; for example, this cURL request saves a WebP screenshot of Stripe:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo API documentation for setup and options. It accepts cookie and consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; those steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf for AI agents. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots.

Sign up for 1,000 free screenshots a month—no card required.

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.