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

Set a screenshot-specific limit by passing timeout, in milliseconds, to page.screenshot():

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

The documented default for this operation is 0 (no screenshot-operation timeout). A screenshot timeout is separate from Playwright Test’s test and assertion timeouts, so choose the setting that matches the failure you are seeing.

Set the timeout on one screenshot

Use the timeout property in the options object passed to page.screenshot(). The value is an integer number of milliseconds.

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

test('save a product screenshot', async ({ page }) => {
  await page.goto('https://example.com');

  await page.screenshot({
    path: 'artifacts/product.png',
    fullPage: true,
    timeout: 30_000,
  });
});

This changes only that screenshot call. It is the clearest choice when one page is unusually slow and the rest of the test suite should keep its normal defaults.

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

Use a longer limit for a known slow page

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

Keep the value tied to the operation’s expected duration rather than applying an arbitrarily large number everywhere. A larger limit gives the operation more time; it does not itself wait for network idle, lazy images, fonts, animations, or any other visual-readiness condition.

Disable the screenshot operation timeout

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

0 means no timeout for the screenshot operation according to the Page API’s documented default behavior. In Playwright Test, the enclosing test can still be stopped by the test-level timeout, so this is not an unlimited test.

Choose the timeout scope

Playwright exposes several timeout layers. Changing one does not automatically change the others.

Setting Scope Unit/default Use it when
page.screenshot({ timeout }) One screenshot operation Milliseconds; documented default 0 A particular capture needs a different limit
page.setDefaultTimeout() Applicable timeout-aware operations on one page Milliseconds Several operations on this page need the same default
browserContext.setDefaultTimeout() Applicable operations in a browser context Milliseconds You want a shared default for pages in that context
actionTimeout in Playwright Test Configured action operations in the test project Milliseconds You need a project-level action default
Playwright Test test timeout The complete test, including setup and assertions Playwright Test documents a 30-second default The error says the whole test exceeded its budget
Assertion timeout Auto-retrying assertions Playwright Test documents a 5-second default An assertion, rather than the screenshot, is timing out

The page.screenshot() API reference documents the operation option and the applicable default-setting mechanisms: Page | Playwright. Playwright Test’s separate test and assertion budgets are described in Timeouts | Playwright.

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

Set a page or context default

Page-wide default

import { chromium } from 'playwright';

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

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

await browser.close();

With this approach, you omit timeout from each applicable call. An explicit timeout on a particular screenshot remains the more visible choice for a one-off exception.

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

Context-wide default

const context = await browser.newContext();
context.setDefaultTimeout(30_000);
const page = await context.newPage();

await page.screenshot({ path: 'context-default.png' });

A context default is useful when multiple pages created from the same context should share the policy. The exact operations affected are those for which Playwright applies the default timeout; it is not a replacement for the test timeout.

Playwright Test project configuration

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

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

actionTimeout is a broad project setting. Use it when the same action budget is appropriate across the project, and override an individual screenshot when its requirement differs.

Keep screenshot, test, and assertion failures distinct

Screenshot operation timeout

A message identifying page.screenshot() or its operation limit points to the screenshot option or an applicable page, context, or action default. Increase that limit only after confirming the capture itself is the slow step.

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.

Test timeout

A test-timeout failure means the complete test exceeded its budget. Raising page.screenshot({ timeout }) will not lengthen that budget. Set the test timeout when navigation, fixtures, screenshot work, and other steps together require more time:

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

test('large capture', async ({ page }) => {
  test.setTimeout(90_000);
  await page.goto('https://example.com');
  await page.screenshot({ path: 'large.png', timeout: 60_000 });
});

Playwright Test documents a 30-second default per test. A test timeout is separate from the assertion timeout.

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.

Assertion timeout

If an auto-retrying assertion is the failing step, adjust its assertion setting rather than the screenshot timeout:

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

test('page is ready before capture', async ({ page }) => {
  await page.goto('https://example.com');
  await expect(page.locator('h1')).toBeVisible({ timeout: 10_000 });
  await page.screenshot({ path: 'ready.png', timeout: 30_000 });
});

Playwright Test documents a 5-second default assertion timeout. Making an assertion wait longer does not alter the screenshot operation’s limit.

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

Timeout does not equal visual readiness

The timeout is a maximum operation duration, not a readiness strategy. If a page is captured before its content is usable, address readiness explicitly:

  • Wait for a navigation state or a specific selector before calling the screenshot method.
  • Use a targeted assertion, such as visibility of the page’s main heading, to verify the expected UI.
  • For lazy-loaded content, scroll or otherwise trigger the page behavior before capture.
  • Disable or wait for animations when deterministic pixels matter.
  • Investigate blocked resources, redirects, authentication, or JavaScript errors instead of masking them with a larger timeout.
await page.goto('https://example.com', { waitUntil: 'domcontentloaded' });
await page.locator('[data-testid="report"]').waitFor({ state: 'visible', timeout: 20_000 });
await page.screenshot({
  path: 'report.png',
  fullPage: true,
  timeout: 30_000,
});

A navigation timeout is also different: it limits page.goto(), not the later screenshot call. Give each stage a deliberate budget.

Common errors and fixes

“The screenshot timed out” despite a large value

  • Check whether the enclosing test hit its shorter test timeout first.
  • Look for a page or context default that overrides your assumption, and pass an explicit call-level value.
  • Check whether the page is stuck on a resource, redirect, login, or browser dialog; a larger limit cannot repair that condition.

The test still ends after 30 seconds

The documented Playwright Test default is 30 seconds per test. Set test.setTimeout() or the test configuration when the complete test needs more time; do not rely on the screenshot option alone.

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

The screenshot is blank or missing content

This is usually a readiness or page-state problem rather than a timeout-value problem. Wait for a meaningful selector, verify the URL and authentication state, and inspect console or network failures. If content is lazy-loaded, trigger its loading before capture.

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

Changing setDefaultTimeout() had no expected effect

Confirm that the operation uses that default and that you changed the correct page or context. For a screenshot-specific guarantee, put timeout directly in the screenshot call.

Assertions fail before the screenshot

Adjust the assertion’s timeout or its readiness condition. Assertion retries have their own budget and are independent of both screenshot and test timeouts.

Practical timeout strategy

  1. Identify the exact failing layer from the error: screenshot operation, navigation, assertion, or whole test.
  2. Start with an explicit screenshot value, such as 30_000, for a single slow capture.
  3. Set a page, context, or actionTimeout default only when multiple operations genuinely share the requirement.
  4. Increase the test timeout if the aggregate workflow cannot finish within the test budget.
  5. Add readiness waits and diagnose blocked resources before choosing a much larger number.
  6. Keep the smallest limit that accommodates normal conditions, so hangs fail promptly and reveal regressions.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If you only need a hosted screenshot, ScreenshotNeo provides a GET endpoint that returns PNG, JPEG, WebP, or PDF. Its capture options include full-page shots, selector-based elements, device and viewport settings, custom CSS or JavaScript, waits, headers, cookies, authentication, blocking rules, caching, and asynchronous jobs.

Example cURL call (see the ScreenshotNeo documentation):

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

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}`);
const body = Buffer.from(await res.arrayBuffer());
require('fs').writeFileSync('shot.webp', body);

Before capture, ScreenshotNeo accepts cookie and consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be disabled. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed as clean shots, and response headers identify the page verdict and billing status. Its MCP server lets Claude, Cursor, and other MCP clients use take_screenshot, get_page_info, and capture_pdf. The Free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.

FAQ

What unit does the screenshot timeout use?

Milliseconds. For example, 30_000 is 30 seconds.

Does timeout zero mean Playwright waits forever?

It removes the screenshot operation’s own timeout. An enclosing Playwright Test timeout, process termination, or another limit can still stop the run.

Should I raise the screenshot or test timeout first?

Raise the limit belonging to the error. Use the screenshot option for one capture and the test timeout for the complete test budget.

Frequently Asked Questions

Can I set a different timeout for each screenshot?

Yes. Pass a different timeout value in each page.screenshot() options object.

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

Will a longer screenshot timeout make images load?

No. It only extends the operation’s allowed duration; add explicit readiness waits and investigate resource or page-state problems.

Where is the official API reference?

The Page API reference is available at playwright.dev/docs/api/class-page.

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.