Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
browser automation

How to Set a Timeout for Website Capture Requests (Playwright and API Workflows)

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

Set a website-capture timeout at the layer that can actually hang. In Playwright, pass milliseconds to page.goto() for one navigation, use page.setDefaultNavigationTimeout() or a browser-context default for repeated captures, and configure Playwright Test’s navigationTimeout for a project-wide policy. Direct HTTP calls use the timeout on their request API instead. A timeout controls how long an operation may run; a separate readiness condition controls when the page is usable for a screenshot.

Choose the timeout scope before changing the number

A capture pipeline can contain several independently timed operations. Identify the failing operation first, then set its limit:

Operation Where to configure it What it limits
One browser navigation page.goto(url, { timeout: ... }) That navigation call only
Every navigation on a page page.setDefaultNavigationTimeout(...) Navigation methods on that page
Every navigation in a context Browser-context default navigation timeout Pages created in the context
Clicks and other actions actionTimeout or an action’s own timeout Actions such as clicks, fills and checks
Playwright Test project use.navigationTimeout Navigation operations in tests
Direct HTTP request APIRequestContext request timeout HTTP requests made through the request API
Whole capture job Your job runner or test timeout The complete workflow, including setup and post-processing

These limits do not automatically control one another. Increasing a browser navigation timeout will not extend a direct API request, and a generous per-call limit cannot outlive a shorter outer job timeout.

Set a timeout for one Playwright capture

Use a finite value in milliseconds on the navigation that is known to be slow. The following TypeScript example waits for the DOM to be parsed, then captures the full page:

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
import { chromium } from 'playwright';

const browser = await chromium.launch();
const page = await browser.newPage();

const targetUrl = 'https://example.com';
await page.goto(targetUrl, {
  timeout: 30_000,
  waitUntil: 'domcontentloaded',
});

await page.screenshot({ path: 'example.png', fullPage: true });
await browser.close();

30_000 means 30 seconds. It is the value shown in Playwright’s documentation examples, not a universal response-time recommendation or a service guarantee. Select a limit from your observed latency and the amount of time your application can spend on one capture.

Use the slowest known destination as a per-call exception

Keep a normal default for most pages and override only the outlier:

await page.goto(fastUrl, { waitUntil: 'domcontentloaded' });
await page.goto(slowUrl, {
  timeout: 60_000,
  waitUntil: 'domcontentloaded',
});

Do not silently retry an indefinitely hanging site. Catch the timeout, record the URL and elapsed time, and decide whether to retry, skip, or report the capture as failed.

Set defaults for repeated captures

Page-level default

A page default prevents you from repeating the option on every navigation:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
page.setDefaultNavigationTimeout(30_000);
await page.goto('https://example.com', { waitUntil: 'domcontentloaded' });
await page.goto('https://example.org', { waitUntil: 'domcontentloaded' });

This changes the navigation limit for that page. It does not set an action timeout for operations such as clicking a button.

Context-level policy

When a capture worker creates several pages in one browser context, set the default at context scope so new pages share the same navigation policy. Keep an individual page.goto override for exceptional destinations. The exact context API name depends on the Playwright version you use; verify it in the API reference for that version rather than assuming a page setting affects every context.

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

Playwright Test configuration

For a Playwright Test project, navigation and action defaults are separate:

import { defineConfig } from '@playwright/test';

export default defineConfig({
  use: {
    actionTimeout: 10_000,
    navigationTimeout: 30_000,
  },
});

The documented values are examples. A test-level timeout is another outer limit, so it must be longer than the navigation, actions, screenshot work and any cleanup you expect in that test. Otherwise the test can end while an individual operation still has time remaining.

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

Navigation timeout and readiness are different decisions

A navigation can finish its selected event while the page is still unsuitable for a screenshot. Conversely, waiting for every network request can delay a page indefinitely because analytics, advertisements or long-lived connections never settle.

Select an appropriate waitUntil event

  • commit: navigation has committed a response. Use only when an early document is sufficient.
  • domcontentloaded: the initial HTML has been parsed. This is often a practical baseline for capture pipelines that perform their own readiness check.
  • load: the load event has fired, including resources that participate in that event.
  • networkidle: Playwright documents this condition as discouraged for tests and recommends web assertions to assess readiness instead. Sites with persistent connections may never become idle.

Add an explicit assertion or selector wait for the content that must appear in the image:

await page.goto(targetUrl, {
  timeout: 30_000,
  waitUntil: 'domcontentloaded',
});
await page.locator('[data-capture-ready="true"]').waitFor({
  state: 'visible',
  timeout: 10_000,
});
await page.screenshot({ path: 'ready.png', fullPage: true });

Here, navigation may complete quickly, while the readiness selector gets its own action-style timeout. This makes a missing application state distinguishable from a slow server response.

Configure direct HTTP capture requests separately

If your workflow fetches a page with Playwright’s APIRequestContext instead of opening a browser page, set that request API’s timeout. A page.goto value has no authority over this client.

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.
import { request } from '@playwright/test';

const api = await request.newContext({
  timeout: 30_000,
});

const response = await api.get('https://example.com');
console.log(response.status());
await api.dispose();

Use this approach for HTTP status or HTML retrieval, not for a browser-rendered screenshot. JavaScript execution, cookies, fonts and layout require a browser page and its navigation settings.

Should you use 0 to disable a timeout?

Playwright’s documented timeout options treat 0 as disabling that timeout. An unbounded navigation can leave a worker occupied forever when a server, proxy or connection never completes. Prefer a finite limit tied to your job budget. Use zero only when you have another reliable cancellation mechanism, such as a process-level deadline or an external job lease, and have deliberately accepted the risk.

Design a timeout policy from measurements

  1. Measure stages separately. Record DNS/connect, navigation, readiness wait and screenshot durations where your infrastructure exposes them.
  2. Choose the completion condition. Decide whether parsed HTML, the load event or a specific selector means the capture is ready.
  3. Set a per-stage budget. Give navigation and readiness independent finite limits so one cannot consume the entire job.
  4. Reserve outer-job time. The worker deadline must include browser launch, retries, image encoding, upload and cleanup.
  5. Classify failures. Distinguish navigation timeout, readiness timeout, action timeout and outer-job cancellation in logs and metrics.
  6. Adjust from records. Increase a limit only when failures show the operation is legitimately slow; do not raise every timeout to mask broken links or stalled scripts.

No official Playwright documentation establishes one optimal number for all websites. The right value depends on the destinations, network path, rendering work and operational budget of your application.

Troubleshoot common capture timeout failures

“Timeout exceeded” from page.goto

Cause: navigation did not reach the selected waitUntil event in the per-call or default limit.

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

Fix: verify the URL independently, inspect server and proxy latency, choose a suitable readiness event, and increase only that navigation’s finite timeout if the destination is known to be slow.

The page loads in a browser but the screenshot is blank

Cause: navigation completed before the application rendered its content, or the capture ran before a client-side route finished.

Rank #4
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

Fix: wait for a stable, visible selector or assertion after navigation. Do not rely on a larger navigation timeout alone; extra time does not define what “ready” means.

Increasing page.goto does nothing

Cause: the failing operation is likely a click, locator wait, direct HTTP request or outer test/job timeout.

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

Fix: identify the operation in the stack trace and configure its own timeout scope. Check actionTimeout, request-context timeout and test timeout independently.

networkidle never arrives

Cause: analytics, WebSockets, polling or other persistent requests keep the network active.

Fix: use domcontentloaded or load, then wait for the exact selector or assertion that proves the content needed for the image is present.

The whole test stops before navigation’s limit

Cause: the Playwright Test test-level timeout or an external worker deadline is shorter than the navigation setting.

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.

Fix: make the outer budget longer than all intended operations, or shorten inner limits so cancellation is predictable. Keep cleanup and retry time in the calculation.

Retries multiply the delay

Cause: each retry receives the full navigation timeout, so a dead host can consume several times the nominal limit.

Fix: cap the total job budget, use a smaller retry timeout or retry only transient network errors. Record attempt number and cumulative elapsed time.

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

Or skip the browser setup

ScreenshotNeo provides a hosted website screenshot API when you do not want to maintain Playwright, browser binaries and timeout handling. Its endpoint accepts one GET request and returns PNG, JPEG, WebP or PDF output. Cookie and consent banners are accepted before capture, and more than 60 known consent platforms, newsletter popups and chat widgets are removed; each cleanup step can be turned off. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and the response identifies the 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.

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.

See the ScreenshotNeo documentation for request options and response details.

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}`);
const fs = await import('node:fs/promises');
await fs.writeFile('shot.webp', Buffer.from(await res.arrayBuffer()));

ScreenshotNeo has 1,000 free shots per month with no card. Paid plans start at $5 for 3,000 shots; every feature is on every plan, and yearly billing gives two months free. Sign up for the free plan.

Frequently Asked Questions

Does a navigation timeout also limit screenshot encoding?

No. It bounds navigation. Screenshot encoding, file writing, uploads and the overall job need their own limits in your workflow.

What timeout should I use for a page with slow images?

There is no documented universal value. Use a finite navigation limit based on measured latency, then wait for the image or page-ready condition that your capture actually requires.

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

Can I use a browser navigation timeout for an API call?

No. Configure the timeout on the direct request API, such as Playwright’s APIRequestContext, when the operation is an HTTP request rather than page navigation.

Why did my request finish but miss content loaded after navigation?

The selected navigation event completed before the application finished rendering. Add a selector or assertion-based readiness wait after navigation.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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.

Read next

Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.