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

A timeout reported after page.evaluate() has two common causes: the function evaluated in the browser returned a Promise that never settles, or a later navigation/selector/network wait reached its own timeout. Add logs around each operation, identify the exact wait that expires, and match the wait condition to what the application actually does.

First, identify which operation timed out

page.evaluate() executes JavaScript in the page context. Puppeteer waits for the value it returns; when that value is a Promise, Puppeteer waits for the Promise to resolve before returning. An in-page fetch that never resolves, an event listener waiting for an event that never fires, or an accidental polling loop can therefore make evaluate() appear hung.

Navigation and readiness methods are separate operations. goto(), reload(), setContent(), history navigation, and waitForNavigation() have navigation timeouts. Selector, URL, response, function, and network-idle waits have their own limits. A navigation timeout does not resolve an in-page Promise.

Instrument the boundary

console.log('before evaluate');
const value = await page.evaluate(() => {
  // Keep this synchronous unless you deliberately return a settling Promise.
  return document.querySelector('[data-ready]')?.textContent ?? null;
});
console.log('after evaluate', value);

console.log('before waitForNavigation');
await page.waitForNavigation({
  waitUntil: 'domcontentloaded',
  timeout: 30_000,
});
console.log('after waitForNavigation');

If “after evaluate” never prints, inspect only the evaluated function first. If both evaluate logs print and the next message reports a navigation timeout, debug the navigation trigger and its readiness condition instead.

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.

Fix an evaluate call that never settles

Do not return an unbounded Promise

// Risky: the page may never dispatch this event.
await page.evaluate(() => new Promise(resolve => {
  window.addEventListener('app-ready', resolve, { once: true });
}));

Prefer a bounded operation. If the page exposes a readiness element, wait for it from Puppeteer:

await page.waitForSelector('[data-ready]', { timeout: 15_000 });
const text = await page.$eval('[data-ready]', el => el.textContent);

For an in-page operation that truly must be asynchronous, add a deadline and reject when it is exceeded:

await page.evaluate(async () => {
  const controller = new AbortController();
  const timer = setTimeout(() => controller.abort(), 10_000);
  try {
    const response = await fetch('/api/status', { signal: controller.signal });
    if (!response.ok) throw new Error(`HTTP ${response.status}`);
    return await response.json();
  } finally {
    clearTimeout(timer);
  }
});

Check loops and event assumptions

  • Ensure every while or polling loop changes state and has a maximum attempt count.
  • Confirm the event listener is installed before the action that emits the event.
  • Do not wait for a browser event when the application updates only its own state or DOM.
  • Log values returned from the page so a false condition cannot silently repeat forever.

Handle a real click-triggered navigation without a race

For a link or button that loads a new document, arm the navigation wait before clicking. Puppeteer’s documented pattern is to create both promises together:

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.
const [response] = await Promise.all([
  page.waitForNavigation({
    waitUntil: 'domcontentloaded',
    timeout: 30_000,
  }),
  page.click('a.next'),
]);

if (!response) {
  throw new Error('The click did not produce a navigation response');
}
console.log('landed on', page.url());

Calling await page.click() and then await page.waitForNavigation() can miss a fast navigation because the event may occur before the wait is registered.

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.

Prove that the action navigates

Some controls do not navigate at all. A single-page application may change the URL with the History API, replace a view, or fetch data while the document remains loaded. In those cases, waitForNavigation() can wait until its timeout forever.

Choose the signal that represents completion:

  • DOM change: await page.waitForSelector('.results', { timeout: 15_000 });
  • URL change: await page.waitForFunction(() => location.pathname === '/done', { timeout: 15_000 });
  • Specific response: await page.waitForResponse(r => r.url().endsWith('/api/items') && r.ok(), { timeout: 15_000 });
  • Application readiness: wait for a stable, page-specific marker such as [data-loaded="true"].

Pair a response wait with the action when the request is the reliable signal:

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.
const [apiResponse] = await Promise.all([
  page.waitForResponse(
    response => response.url().endsWith('/api/items') && response.request().method() === 'GET',
    { timeout: 20_000 }
  ),
  page.click('button.load-items'),
]);

if (!apiResponse.ok()) throw new Error(`Items request failed: ${apiResponse.status()}`);

Choose the right waitUntil condition

domcontentloaded usually finishes when the initial document is parsed. load waits for the document’s load event, including load-blocking resources. networkidle0 requires no active network connections for the idle window, while networkidle2 allows limited activity.

Network-idle waits are fragile on pages with analytics, polling, advertisements, WebSockets, or long-lived requests. If the page is usable once a known component appears, a selector wait is generally more deterministic:

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.
await page.goto('https://example.com/dashboard', {
  waitUntil: 'domcontentloaded',
  timeout: 30_000,
});
await page.waitForSelector('#dashboard-ready', { timeout: 20_000 });

This is an engineering choice, not a universal rule: verify that the selected marker really means the data your task needs is available.

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

Timeout settings: scope them deliberately

Use per-call limits first

await page.waitForNavigation({ waitUntil: 'domcontentloaded', timeout: 30_000 });
await page.waitForSelector('.invoice', { timeout: 10_000 });
await page.waitForResponse(predicate, { timeout: 20_000 });

A per-call value documents which operation may be slow and prevents a generous setting from masking unrelated hangs.

Set a navigation policy only when appropriate

page.setDefaultNavigationTimeout(45_000);
await page.goto(url, { waitUntil: 'domcontentloaded' });

This default covers navigation methods such as goto, reload, content setting, history navigation, and waitForNavigation. It does not make an unresolved Promise inside page.evaluate() complete.

Be cautious with timeout: 0

Puppeteer documents timeout: 0 as disabling the timeout for methods that accept it. That can be useful for a deliberately unbounded operation, but in a service it can leave a job blocked indefinitely. Prefer a finite deadline and an outer job-level cancellation policy.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Diagnose the common failure patterns

Symptom Likely cause Fix
No log after evaluate() Returned Promise, event wait, fetch, or loop never settles Make the operation bounded; move readiness checks to Puppeteer waits; add loop limits.
“Navigation timeout” after a click Click did not navigate, or the wait was attached too late Use Promise.all; verify URL/document changes; use selector, URL, or response waits for an SPA.
networkidle0 always times out Persistent analytics, polling, WebSocket, or other connections Use domcontentloaded plus a specific selector, or a less strict condition that matches the task.
Timeout disappears when logging is added Timing-sensitive race or borderline readiness condition Register waits before actions, use explicit predicates, and avoid arbitrary sleeps as the primary fix.
Increasing the timeout changes nothing Event never occurs or Promise cannot resolve Identify the awaited event and prove it occurs; a larger number is not a substitute for a valid condition.

A complete diagnostic example

import puppeteer from 'puppeteer';

const browser = await puppeteer.launch();
const page = await browser.newPage();
page.setDefaultNavigationTimeout(30_000);

try {
  console.log('goto start');
  await page.goto('https://example.com', { waitUntil: 'domcontentloaded' });
  console.log('goto done', page.url());

  console.log('evaluate start');
  const hasNext = await page.evaluate(() => Boolean(document.querySelector('a.next')));
  console.log('evaluate done', { hasNext });

  if (hasNext) {
    console.log('click/navigation start');
    await Promise.all([
      page.waitForNavigation({ waitUntil: 'domcontentloaded', timeout: 30_000 }),
      page.click('a.next'),
    ]);
    console.log('navigation done', page.url());
  } else {
    await page.waitForSelector('.results', { timeout: 15_000 });
  }
} finally {
  await browser.close();
}

Run this with the exact target URL and selectors. Record Puppeteer’s version, browser revision, URL, final log line, and complete stack trace; behavior can differ between sites and versions.

Or skip the browser setup

If your goal is a clean image or PDF rather than browser automation, ScreenshotNeo provides a single HTTP request. It accepts consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be disabled. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the page verdict and billing status in X-Page-Verdict and X-Billed headers. Its MCP server exposes take_screenshot, get_page_info, and capture_pdf to Claude, Cursor, and other MCP clients.

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)
r.raise_for_status()
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}`);
if (!res.ok) throw new Error(`Screenshot failed: ${res.status}`);
require('fs').writeFileSync('shot.webp', Buffer.from(await res.arrayBuffer()));

See the parameter reference and output details in the ScreenshotNeo documentation. The Free plan includes 1,000 screenshots each month with no card; paid plans start at $5 for 3,000. Create a free ScreenshotNeo account.

Practical reliability checklist

  • Log immediately before and after every awaited operation.
  • Include the operation name and timeout in error messages.
  • Register event waits before the action that triggers them.
  • Use selectors, URL predicates, or responses for SPA transitions.
  • Avoid networkidle0 when persistent connections are expected.
  • Keep finite per-call timeouts and enforce an outer job deadline.
  • Capture the exact URL, Puppeteer version, browser revision, and stack trace when escalating.

Frequently Asked Questions

Does page.evaluate() have its own timeout option?

The important distinction is that Puppeteer waits for a returned Promise; configure a deadline inside the page operation or enforce cancellation around the job, rather than assuming a navigation timeout will resolve it.

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

Why does the URL change but waitForNavigation() time out?

History API updates and client-side routing can change the URL without a document navigation. Wait for the new URL, a response, or an application-specific DOM marker instead.

Should I always use networkidle2 instead of networkidle0?

Neither is universally correct. Select the least strict condition that represents readiness; on many applications a known selector is more deterministic than either network-idle condition.

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.