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

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

A Playwright screenshot error saying the page, target, context, or browser is closed means the screenshot call can no longer use the browser object it was given. First identify which object closed, then trace who owns it and whether cleanup ran too early. If the Page is open, investigate browser crashes, resource pressure, page-specific behavior, and differences between local and remote execution. The message alone does not identify the root cause.

Start by finding out what closed

Playwright exposes separate lifecycle methods for a Page, BrowserContext, and Browser. A Page can be closed while its context or browser remains alive; closing a context also closes its pages, and closing a browser ends the browser session. A screenshot error can therefore point to a lost target without revealing which lifecycle event caused it. The Playwright Page API documents page.screenshot(), page.close(), and page.isClosed(); the API describes isClosed() as indicating that the page has been closed.

Check the Page immediately before the capture

In JavaScript or TypeScript, inspect the page state at the point where the screenshot is about to happen:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
if (page.isClosed()) {
  throw new Error('Cannot take screenshot: the Playwright page is already closed');
}

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

This check distinguishes an already-closed Page from a failure that occurs during capture. It does not tell you why the page closed. If your binding does not expose this exact JavaScript API, check the corresponding Page API for that language and version.

#1 Best Overall
HP OmniBook 3 17.3 inch Laptop PC, FHD Display, AMD Ryzen 3 30, 8 GB RAM, 512 GB SSD, AMD Radeon 610M Graphics, Windows 11 Home, Mica Silver, 17-dp0199nr
  • FULL HD IPS DISPLAY - Enjoy vibrant, crystal-clear images with 178-degree wide-viewing angles
  • AMD RYZEN 3 30 PROCESSOR - Everyday performance you can count on; Multitask, stream, game casually, and edit photos smoothly with responsive power and vibrant HDR visuals
  • ENJOY UP TO 14 HOURS AND 15 MINUTES OF BATTERY LIFE - HP Fast Charge restores battery from 0 to 50% in approximately 45 minutes
  • AMD RADEON 610M GRAPHICS - Experience smooth entertainment; Built for streaming and multitasking, enjoy realistic visuals and efficient performance for work and play
  • STORAGE AND MEMORY - 512 GB PCIe NVMe M.2 SSD offers fast speed and efficient storage; and 8 GB LPDDR5 RAM memory boosts performance with higher bandwidth

Trace the owning objects and cleanup

Search the code path and test harness for every call that can end the page’s lifetime:

  • page.close() closes that Page.
  • context.close() closes pages owned by that BrowserContext.
  • browser.close() ends the browser session and invalidates its contexts and pages.

Follow the object that created the page through its owner. Check whether a helper, test hook, error handler, fixture teardown, or parallel task can close the owning context or browser before the screenshot promise has completed. Await the screenshot operation before teardown; do not start it as detached work and then close its owner.

Check fixture lifetime and browser reuse

If the error occurs in a test runner or editor integration, inspect fixture setup and teardown order rather than assuming the site or screenshot options are responsible. In a 2023 report involving Playwright 1.30.0, a custom Page was closed before the test ran when combined with built-in fixtures under the VS Code extension’s browser-reuse option. The report makes fixture ownership and order worth checking in a similar setup; it does not establish that the extension or fixture order causes closed-page errors generally. See the reported VS Code fixture interaction for that specific case.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
HP 14" HD Chromebook Laptop for Students, Intel Quad-Core N4120(> N4020), 4GB RAM, 64GB eMMC, WiFi, Webcam, HDMI, USB-A&C, 14 Hours Battery Life, Zoom, Chrome OS, CUE Accessories
  • Intel Celeron N4120: 4 Cores & Threads, 1.1GHz Base Clock, Up to 2.6GHz Boost Clock, 4MB Cache, Intel UHD Graphics 600. The perfect combination of performance, power consumption, and value helps your device handle multitasking smoothly and reliably with four processing cores to divide up the work.
  • 14" HD Display: 14.0-inch diagonal, HD (1366 x 768), micro-edge, anti-glare. See your digital world in a whole new way. Enjoy movies and photos with the great image quality and high-definition detail of 1 million pixels.
  • Memory & Storage: 4 GB LPDDR4x & 64 GB eMMC Storage. Adequate high-bandwidth RAM to smoothly run multiple applications and browser tabs all at once. An embedded multimedia card provides reliable flash-based storage.
  • Ports:2 x USB 3.0 Type-A,1 x USB 3.0 Type-C,1 x HDMI,1 x Headphone Jack
  • Chrome OS: Chromebook is a computer for the way the modern world works, with thousands of apps. Enjoy the seamless simplicity that comes with Google Chrome and Android apps, all integrated into one laptop. It’s fast, simple, and secure.
  1. Identify whether the Page comes from a built-in fixture or is created by your own setup code.
  2. Check which fixture owns the BrowserContext and when its teardown runs.
  3. Verify that the screenshot test receives the same live Page you created, rather than a stale reference.
  4. Temporarily disable browser reuse or custom fixture composition if available, changing one variable at a time.

Do not fix this by removing cleanup indiscriminately: closing contexts and browsers is still necessary to release resources. Adjust ownership or ordering so the capture completes before the owner is closed.

If the Page is open, investigate crashes and resource pressure

A Page-state check may pass immediately before an error because the browser process can fail during navigation or screenshot capture. In that case, inspect browser-process output, memory use, concurrency, and how long the session has been running. Treat these as investigation paths, not presumed causes.

Memory and long-running sessions

A report against Playwright 1.40.0 described Chromium running out of memory after thousands of navigations and hanging at a screenshot call. That individual report does not establish a general navigation threshold or a universal fix. If your failure appears late in a long run, record memory use over time, the number of pages and navigations, and whether a fresh browser process changes the result. See the Playwright 1.40.0 report.

Rank #3
Sale
AKCHART 15.6'' AI Laptop with Office 365 12GB RAM 256GB SSD Win 11 Laptops
  • Stunning 15.6" FHD IPS Display: Experience crisp 1920x1080 resolution on this 15.6 inch laptop with an IPS panel that delivers wide viewing angles and vivid colors. The narrow-bezel design maximizes screen real estate for comfortable viewing on this Win 11 laptop, whether you're studying or working.
  • Celeron J4105 Processor & 256GB SSD: Powered by a reliable Celeron J4105 processor paired with 12GB DDR4 memory and a fast 256GB M.2 SSD. This laptop computer supports SSD expansion up to 2TB and TF card expansion up to 1TB, so your storage grows with your needs. Delivers smooth multitasking for daily productivity.
  • AI-Powered Win 11 Laptop: Built-in AI features enhance your productivity with smart assistance for writing, summarizing, and task management. Pre-installed with Win 11 and includes Office 365 subscription. This student laptop is backed by 1-year warranty and 24/7 customer support.
  • All-Day 7000mAh Battery & 180° Hinge: The high-capacity 7000mAh battery keeps this laptop powered through long classes or meetings. The 180-degree lay-flat hinge lets you share your screen effortlessly during presentations. This durable laptop computer adapts to your dynamic workflow.
  • Versatile Connectivity Hub: Equipped with USB 3.2, Type-C, Mini HDMI, and 3.5mm audio jack to connect all your peripherals. Stay online anywhere with high-speed 5G WiFi and Bluetooth 4.2. This college laptop keeps you connected at home, in the library, or on the go.

Concurrency and browser stability

A separate report for Playwright 1.45.0 described occasional Target crashed screenshot failures in a multithreaded, long-lived setup. If your workload is concurrent, compare a single worker and short-lived browser against the failing configuration. If lowering concurrency changes the failure, that narrows the investigation; it does not by itself prove why the browser crashed. See the Playwright 1.45.0 report.

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

Separate site behavior from capture and connection mode

Reduce the problem to a comparison matrix. Keep the Playwright version and browser engine fixed while changing one axis at a time:

Comparison What it helps isolate
Failing site versus a minimal or known-good page Whether the failure is tied to the target page, its load behavior, or a broader capture path.
Viewport screenshot versus full-page screenshot Whether the failure is associated with full-page capture rather than the basic screenshot path.
Local browser launch versus remote connection Whether the execution or transport setup is a necessary condition for reproducing the failure.
One short-lived page versus the long-running or concurrent workload Whether duration, accumulated state, or concurrency correlates with the failure.

These comparisons localize a failure; none alone proves a root cause. In a report for Playwright 1.39.0, a 30-second full-page screenshot timeout affected one site while other sites worked. The report supports isolating the target and capture type, but does not provide a confirmed general fix. See the site-specific full-page timeout report.

Rank #4
HP Essential Laptop 2026, Intel CPU, 128GB Storage, Office 365, Windows 11
  • Efficient Performance for Everyday Computing: Powered by Intel N150 processor with up to 3.6 GHz Intel Turbo Boost Technology, 6 MB L3 cache, 4 cores, and 4 threads, this HP laptop delivers responsive performance for web browsing, streaming, document editing, and multitasking. Paired with 4GB LPDDR5 RAM and 128GB UFS storage, it handles daily tasks smoothly. Includes 1-year Microsoft 365 Personal subscription for Word, Excel, PowerPoint, and cloud storage to maximize your productivity.
  • 14-Inch HD Micro-Edge Display:Enjoy clear visuals on the 14-inch HD (1366 x 768) anti-glare screen with 250-nit brightness and 62.5% sRGB coverage. The micro-edge bezel delivers a 79% screen-to-body ratio in a compact design. An HP True Vision 720p HD camera with noise reduction and dual-array microphones supports clear video calls, remote work, and online learning.
  • Modern Connectivity and Wireless Technology: Stay connected with Wi-Fi 6 (2x2) for faster wireless speeds and Bluetooth 5.4 for seamless pairing with accessories. Versatile port selection includes 1 USB Type-C 10Gbps with DisplayPort 1.2 for external displays, 2 USB Type-A 5Gbps ports for peripherals, 1 HDMI 1.4b port, 1 headphone/microphone combo jack, and 1 multi-format SD media card reader. Connect monitors, transfer files quickly, and expand your workspace with ease.
  • All-Day Battery Life and Portable Design: Enjoy up to 11 hours of video playback, 7.5 hours of mixed usage, or 7.5 hours of wireless streaming on a single charge, perfect for students and professionals on the go. Weighing just 3.24 lb and measuring 12.76" x 8.86" x 0.71", this lightweight laptop fits easily in backpacks and bags. The stylish willow green top cover with matte finish and natural silver keyboard deck with vertical brushing pattern offer a modern, professional look.
  • AI-Enhanced Productivity: Access Microsoft Copilot instantly with the dedicated Copilot key for faster assistance. AI Noise Reduction filters background sounds and improves voice clarity during calls. Dual speakers provide clear audio, while the full-size natural silver keyboard and HP Imagepad support comfortable typing and navigation.

An older report described a screenshot hang with a BrowserServer connection in a Docker setup and contrasting behavior with local launch. It concerns an early, specific environment, so use remote-versus-local comparison as a diagnostic axis rather than applying its outcome to current releases. See the BrowserServer connection report.

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

Build a reproduction that can be diagnosed

When asking for help or comparing runs, provide enough detail to distinguish lifecycle errors from browser or environment failures:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • The complete error, stack trace, and Playwright call log.
  • The Playwright package and language-binding version, browser engine, and browser version if available.
  • Operating system or container details.
  • Whether the browser is launched locally or reached through a remote connection.
  • Whether the capture is viewport or full-page, and the relevant screenshot options.
  • How long the browser and page have been alive and how many navigations or captures preceded the failure.
  • Worker/thread count and whether reducing concurrency changes the result.
  • Fixture setup, teardown, and surrounding close calls.

Then reduce the test to one page and one screenshot. Preserve the exact failing setup first; simplify only after you can reproduce it, so that you do not accidentally remove the condition that triggers the error. Issue reports across Playwright 1.30.0, 1.39.0, 1.40.0, and 1.45.0 describe different environments and outcomes; they are examples, not prevalence data or proof of a universal cause.

Best Value
Sale
jumper 15.6" FHD Laptop, 12GB RAM 256GB Storage Expandable to 512GB
  • Efficient Intel Processor: Powered by Intel Celeron 5205U dual-core two-thread processor with a fixed 1.9GHz base frequency, 2MB Intel Smart Cache and advanced 14nm Comet Lake lithography. Integrated Intel UHD Graphics for 10th Gen Intel Processors delivers stable daily performance. It handles daily office tasks, web browsing, video streaming and light multitasking smoothly while featuring ultra-low power consumption for extended use.
  • Fast Response Large Storage:Equipped with 12GB high-speed RAM to accelerate program loading and enable seamless multitasking. Built-in 256GB solid-state drive provides rapid boot and application launch speeds, offering ample storage space for your documents, software, photos and videos. Run daily productivity and multimedia applications without lag or slowdowns.
  • 15.6" FHD IPS Eye-Care Display:This laptop features a 15.6-inch Full HD IPS panel with native 1920×1080 resolution and classic 16:9 widescreen ratio. Designed with slim 5mm ultra-narrow bezels, anti-glare coating and blue light filtering eye protection, it effectively reduces eye strain during long hours of studying, streaming or working, delivering vivid, immersive visual experiences. effectively reduce blue light and eye strain, bringing you immersive visual experience for watching videos and studying.
  • Pre‑Installed Windows 11: Ready to Use Comes with a genuine Windows 11 system pre‑loaded, offering a clean, intuitive interface and broad software compatibility. Open the box, power on, and you're all set for school assignments, business reports, or daily computing needs.
  • Rich Ports & Long Lasting Battery Life:Built-in 38Wh rechargeable battery and dual stereo speakers. Support Bluetooth 4.2 & 2.4G/5G dual-band WiFi for fast wireless connection. Equipped with Type-C, HDMI, 3.5mm audio jack, dual USB 3.0, Micro TF slot and DC charging port, meet your daily external device connection and office expansion needs.

Common symptoms and what to try

Symptom Next check
page.isClosed() is true before capture Trace calls to page.close(), the owning context’s close, fixture teardown, and whether the test holds a stale Page reference.
The Page check passes, then capture fails Look for browser-process crashes, memory pressure, or concurrent work; preserve process logs and reproduce with one worker.
Only one site fails Compare with a minimal page and a second site; test viewport capture separately from full-page capture.
Only remote execution fails Compare with a local launch while keeping the version, engine, page, and capture options constant.
Failure appears only after a long run Track memory and workload duration; compare a fresh short-lived browser with the accumulated run.
Failure appears only under the test runner or editor Inspect fixture ownership, teardown order, and browser-reuse settings in a minimal test.

Or skip the browser setup

If the task is to obtain a page image or PDF rather than diagnose Playwright itself, ScreenshotNeo is a website screenshot API and MCP server. Its single GET request can return a PNG, JPEG, WebP, or PDF. The service accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; those steps can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, with response headers indicating the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents.

For example, save a WebP capture of Stripe with cURL:

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. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots. Sign up for free screenshots.

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.

Cost and reliability considerations when fixing a local capture

Retries can make a flaky run look healthier while hiding a lifecycle or crash condition. Before adding retries, log whether the Page, context, and browser are still available, and record whether the same target and execution mode failed. A bounded retry may be appropriate for a genuinely transient failure, but it cannot repair a closed owner or an unstable browser process. For recurring workload failures, compare the cost and operational trade-offs of browser reuse, fresh browser processes, and reduced concurrency in your own environment; the incident reports cited here do not establish a universally safe setting.

No prevalence rate is established by the Playwright API documentation or the individual issue reports cited above. Confirm any version-specific behavior against your installed Playwright release and a reproduction matching your operating system, browser, and connection mode.

Frequently Asked Questions

Does the closed-page message mean the website closed my browser page?

No. The error indicates the screenshot operation lost access to its target, but does not establish whether application cleanup, fixture teardown, a context or browser close, or a browser failure caused it.

Should I upgrade Playwright to fix this error?

The cited reports concern different versions and environments and do not establish a general version-specific fix. Reproduce on your installed version and record the browser and environment before attributing the error to a release.

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

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.