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

Set the screenshot operation’s limit with the timeout option, in milliseconds: await page.screenshot({ path: 'screenshot.png', timeout: 30_000 });. The documented default is 0 (no screenshot-operation timeout). Use a page or context default only when you want the change to affect multiple timeout-aware operations, and change the Playwright Test timeout separately when the entire test needs more time.

Playwright has several timeout layers that are easy to confuse. The timeout property on page.screenshot() limits that screenshot call. A page or browser-context default changes the default used by applicable operations. Playwright Test’s test timeout limits the complete test, and its assertion timeout controls auto-retrying assertions. These limits are independent.

Set a timeout for one screenshot

Pass an integer number of milliseconds in the screenshot options object:

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

test('captures the page', async ({ page }) => {
  await page.goto('https://example.com');
  await page.screenshot({
    path: 'artifacts/example.png',
    timeout: 30_000,
  });
});

This gives that operation up to 30 seconds. The option is visible at the call site, so a future reader can see why this particular capture has a longer or shorter limit. The Page API documents the option and its default in the Page API reference.

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

Increase the limit for a slow, one-off capture

await page.screenshot({
  path: 'slow-page.png',
  timeout: 60_000,
});

Use this form when only one page is unusually slow. The value remains in milliseconds; 60_000 is 60 seconds.

Disable the screenshot operation timeout

await page.screenshot({
  path: 'no-operation-limit.png',
  timeout: 0,
});

The documented default is also 0, meaning no timeout for the screenshot operation itself. This does not make a test run forever: Playwright Test can still stop the enclosing test when its own test timeout expires.

Choose the timeout scope that matches the failure

Scope How to set it What it limits When to use it
One screenshot call page.screenshot({ timeout: 30_000 }) That screenshot operation A single capture needs a different limit
Page default page.setDefaultTimeout(30_000) Applicable timeout-aware operations on the page Several operations on one page should share a default
Browser-context default browserContext.setDefaultTimeout(30_000) Applicable timeout-aware operations in the context Multiple pages in the same context need the same default
Playwright Test action default actionTimeout in Playwright Test configuration Applicable actions covered by that configuration The project should use a shared action limit
Whole test Playwright Test’s test-timeout configuration or API The complete test, including setup and other work The error says the test itself exceeded its budget
Assertion Assertion-timeout configuration Auto-retrying assertions An expectation, rather than the screenshot, is timing out

The Page API identifies actionTimeout, browserContext.setDefaultTimeout(), and page.setDefaultTimeout() as ways to change applicable defaults. Keep those defaults separate from the test and assertion limits described in the Playwright Test timeout guide.

Set a page or context default

Page-level default

test('uses a page-wide default', async ({ page }) => {
  page.setDefaultTimeout(30_000);
  await page.goto('https://example.com');
  await page.screenshot({ path: 'artifacts/page-default.png' });
});

With no per-call timeout, applicable operations on this page use the page default. A per-call value remains the clearest way to document an intentional exception:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
page.setDefaultTimeout(30_000);
await page.screenshot({
  path: 'artifacts/extra-slow.png',
  timeout: 60_000,
});

Browser-context default

test('shares a default across pages', async ({ browser }) => {
  const context = await browser.newContext();
  context.setDefaultTimeout(30_000);

  const page = await context.newPage();
  await page.goto('https://example.com');
  await page.screenshot({ path: 'artifacts/context-default.png' });

  await context.close();
});

Use a context default when pages created in that context should inherit the same timeout policy. If only one capture needs extra time, keep the broader default and override that call explicitly.

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 action timeout

In a Playwright Test project, an actionTimeout setting can provide a shared default for applicable actions:

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

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

This is a project-level policy, not a replacement for the timeout option when you want one screenshot to stand out. Check the API behavior for the Playwright version used by your project, because defaults apply only to operations that honor them.

Do not confuse screenshot, test, and assertion timeouts

Playwright Test documents a 30-second default for each test and a separate 5-second default for assertions. Those figures describe Playwright Test’s broader timeout layers, not the page.screenshot() option. The screenshot method’s documented default is 0.

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

When the screenshot operation times out

If the failure identifies the screenshot operation or its configured limit, increase the per-call timeout, adjust the relevant page/context/action default, or remove the operation limit deliberately with timeout: 0. Prefer the narrowest change that fixes the known slow operation.

When the whole test times out

A longer screenshot timeout cannot extend the test’s overall budget. If the test timeout ends the run first, change the Playwright Test test timeout and leave the screenshot setting at the value appropriate for the capture.

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.

When an assertion times out

An assertion timeout concerns an auto-retrying expectation. Raising the screenshot timeout will not give an assertion more retry time; configure the assertion or its applicable default instead.

Timeout is not a page-readiness guarantee

The timeout option is an operation-time limit. The documentation does not define it as a command to wait for network activity, guarantee that every image or script has finished, or ensure that the page is visually ready. Treat readiness and duration as separate decisions.

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

For example, this code gives navigation and capture their own explicit limits, but it does not claim that a 30-second screenshot timeout waits for a particular network condition:

await page.goto('https://example.com', { timeout: 30_000 });
// Add an application-specific readiness check when your page requires one.
await page.screenshot({
  path: 'artifacts/ready-state.png',
  timeout: 30_000,
});

A navigation timeout is also not a screenshot timeout. Diagnose the operation named by the failure before changing any value.

Practical configuration patterns

Keep normal captures short and override known exceptions

test('normal and slow captures', async ({ page }) => {
  page.setDefaultTimeout(15_000);

  await page.goto('https://example.com');
  await page.screenshot({ path: 'artifacts/normal.png' });

  await page.goto('https://example.com/report');
  await page.screenshot({
    path: 'artifacts/report.png',
    timeout: 60_000,
  });
});

This keeps the default visible and bounded while documenting why the report capture is different.

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

Use a shared constant for a team policy

const SCREENSHOT_TIMEOUT_MS = 30_000;

await page.screenshot({
  path: 'artifacts/home.png',
  timeout: SCREENSHOT_TIMEOUT_MS,
});

A named constant avoids mixing seconds and milliseconds when several tests use the same policy.

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

Troubleshoot a Playwright screenshot timeout

“The screenshot still timed out after I increased it”

  • Check whether the message is for the enclosing test rather than page.screenshot(). A test timeout can end the run before the screenshot’s larger limit is reached.
  • Check whether a different page, context, or configuration default is being used than the one you edited.
  • Confirm that the value is in milliseconds: 30_000, not 30, represents 30 seconds.

“I set actionTimeout, but the behavior did not change”

That setting changes an applicable shared default; it does not rewrite an explicit timeout already supplied at the screenshot call. It also does not alter Playwright Test’s whole-test or assertion budgets. Inspect the call and the layer named by the failure.

“I used timeout: 0, but the run still ended”

Zero disables the screenshot operation timeout according to the documented default behavior. The enclosing Playwright Test timeout can still terminate the test. Increase that test budget only when the complete test genuinely needs more time.

“The screenshot finished, but the page is not visually ready”

A larger operation limit does not establish readiness. Add a readiness condition that matches the application, such as waiting for an element your page uses to signal completion, and then capture. Keep that condition separate from the screenshot timeout so a slow operation and an unready page are not mistaken for the same problem.

“Which setting should I change first?”

  1. Read the failure and identify whether it names the screenshot operation, the test, navigation, or an assertion.
  2. For one screenshot, add or change page.screenshot({ timeout: ... }).
  3. For many operations on one page or context, use the corresponding default setter.
  4. For a complete test that legitimately needs more time, change the Playwright Test test timeout.
  5. For a retrying expectation, change the assertion timeout instead.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Performance and reliability considerations

  • Use an explicit per-call limit for exceptional pages rather than making every operation wait longer.
  • Keep the unit in the variable name or constant name, such as SCREENSHOT_TIMEOUT_MS, to prevent accidental second/millisecond conversions.
  • Do not use an unlimited operation timeout as a substitute for a readiness strategy; the test budget may still stop the run, and a completed operation is not documented as proof of visual completeness.
  • Record which layer was changed when diagnosing failures. A screenshot limit, page/context default, test timeout, and assertion timeout solve different failure classes.

Or skip the browser setup

If your goal is simply to obtain a clean website image rather than control a Playwright test, ScreenshotNeo provides a single HTTP request. Its screenshot API accepts a URL and returns PNG, JPEG, WebP, or PDF output. The cURL example below follows the documented endpoint; see the ScreenshotNeo documentation for parameters and response details.

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.
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.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

ScreenshotNeo removes cookie and consent banners, newsletter popups, and chat widgets before capture. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed; the response identifies the result with X-Page-Verdict and X-Billed headers. Its MCP server lets Claude, Cursor, and other MCP clients use take_screenshot, get_page_info, and capture_pdf tools. The Free plan includes 1,000 screenshots per month with no card, and paid plans start at $5 for 3,000 screenshots. Create a free ScreenshotNeo account.

JavaScript and Python alternatives for the same ScreenshotNeo call

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}`);

These requests avoid configuring a browser process, while Playwright remains the right choice when the screenshot is part of a browser test whose timing and assertions you need to control.

Frequently Asked Questions

Is the value passed to page.screenshot() specified in seconds?

No. Playwright defines the screenshot timeout in milliseconds, so 30 seconds is written as 30_000.

Can a screenshot timeout make a page wait for network idle?

Not by itself. It is an operation-time limit; page readiness and any network or application-specific wait must be handled separately.

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

What should I change when only one capture is slow?

Use an explicit timeout on that page.screenshot() call instead of broadening every page, context, or test timeout.

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.