Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
Start by separating two failure classes: a timeout means Pyppeteer waited for a condition that did not occur before its deadline; Target closed or a disconnected protocol means the browser, page, or target disappeared while a command was running. Capture the traceback and browser-process logs before changing timeout values. Then make each wait match the event your task actually needs, verify the Chromium binary and launch options, and only increase a timeout when the process is still healthy.
What the error actually means
A navigation or wait timeout
Pyppeteer documents a 30-second default for navigation and for common selector, function, request, and response waits. A timeout identifies the operation that expired: for example, goto(), waitForSelector(), or waitForFunction(). The condition may be wrong, the site may be slow, or the page may keep loading indefinitely.
You can raise an individual timeout, set a default navigation timeout with page.setDefaultNavigationTimeout(), or pass timeout=0 to disable a timeout. A zero timeout can leave a job waiting forever, so use it only when you also have an external job deadline.
Target closed or a protocol disconnect
Protocol error Page.getFrameTree: Target closed, connection unexpectedly closed, and similar messages mean that the target vanished before the protocol command completed. Possible causes include Chromium exiting, code closing the page or browser too early, or a target disappearing during a frame operation. A longer wait cannot revive a dead process.
#1 Best Overall
- Compact Mouse: With a comfortable and contoured shape, this Logitech ambidextrous wireless mouse feels great in either right or left hand and is far superior to a touchpad
- Durable and Reliable: This USB wireless mouse features a line-by-line scroll wheel, up to 1 year of battery life (2) thanks to a smart sleep mode function, and comes with the included AA battery
- Universal Compatibility: Your Logitech mouse works with your Windows PC, Mac, or laptop, so no matter what type of computer you own today or buy tomorrow your mouse will be compatible
- Plug and Play Simplicity: Just plug in the tiny nano USB receiver and start working in seconds with a strong, reliable connection to your wireless computer mouse up to 33 feet / 10 m (5)
- Better than touchpad: Get more done by adding M185 to your laptop; according to a recent study, laptop users who chose this mouse over a touchpad were 50% more productive (3) and worked 30% faster (4)
Pyppeteer issue #435 (opened April 18, 2023) records this message with Pyppeteer 1.0.2 and headless=False. It demonstrates the symptom and why the operating system, executable, launch flags, and mode must be recorded; it does not prove that non-headless mode is generally broken or establish one universal fix.
Other goto() failures
The API documents navigation failures such as an SSL error, an invalid URL, an exceeded timeout, or a failed main resource. Preserve the original exception and request-failure details instead of converting every navigation error into “increase the timeout.”
A diagnostic sequence that avoids guesswork
1. Save the complete failure context
- Copy the full Python traceback, including the operation immediately before the exception.
- Record Python, Pyppeteer, Chromium/Chrome, and operating-system versions.
- Record whether the run is headless, the exact
executablePath, every launch argument, profile directory, container or CI limits, and environment variables. - Determine whether the browser process exited, whether your code called
page.close()orbrowser.close(), and whether another task reused the same page.
Turn on Pyppeteer’s debug output before reproducing:
Free tools Windows power users keep installed
One-click scans. No signup required.
import pyppeteer
pyppeteer.DEBUG = True
Pass dumpio=True to forward Chromium’s stdout and stderr. Keep those logs with the traceback; an OS-level crash, missing shared library, sandbox refusal, or profile-lock message often appears there rather than in the Python exception.
2. Identify the exact wait
Read the stack from the bottom up. If it ends in a navigation, selector, function, request, or response timeout, write down the condition being awaited and the URL or selector involved. If it ends in Target closed or a disconnected transport, first prove whether Chromium or the target exited. Do not tune a timeout until you know which class you have.
Rank #2
- The next-generation optical HERO sensor delivers incredible performance and up to 10x the power efficiency over previous generations, with 400 IPS precision and up to 12,000 DPI sensitivity
- Ultra-fast LIGHTSPEED wireless technology gives you a lag-free gaming experience, delivering incredible responsiveness and reliability with 1 ms report rate for competition-level performance
- G305 wireless mouse boasts an incredible 250 hours of continuous gameplay on just 1 AA battery; switch to Endurance mode via Logitech G HUB software and extend battery life up to 9 months
- Wireless does not have to mean heavy, G305 lightweight mouse provides high maneuverability coming in at only 3.4 oz thanks to efficient lightweight mechanical design and ultra-efficient battery usage
- The durable, compact design with built-in nano receiver storage makes G305 not just a great portable desktop mouse, but also a great laptop travel companion, use with a gaming laptop and play anywhere
3. Check startup independently
Pyppeteer downloads its Chromium revision on first use when it cannot find one; the project README also documents the pyppeteer-install command for provisioning before a script runs. Confirm that the executable exists, is executable by the service account, and can start in the same container, VM, or CI job as your script.
The API reference says Pyppeteer works best with its bundled Chromium and gives no guarantee for arbitrary Chrome versions. Treat an external executablePath as a compatibility variable. Keep the installed Pyppeteer version, bundled revision, external browser version, launch flags, and environment together when comparing runs.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →4. Change one variable at a time
Preserve launch settings while diagnosing. Relevant options include args, userDataDir, env, headless, dumpio, signal-handling options, and autoClose. First reproduce with the documented bundled browser and a minimal launch; then add your custom executable, profile, flags, and application workload one at a time. This distinguishes a startup problem from a page-specific failure.
Choose a completion condition that matches the task
Direct navigation
page.goto() defaults to waitUntil='load'. Pyppeteer also documents domcontentloaded, networkidle0, and networkidle2:
domcontentloaded: the HTML has been parsed; useful when scripts or selectors will determine readiness.load: the page’s load event has fired; this is the default.networkidle0: no active network connections for the required idle window.networkidle2: no more than two active connections for that window.
Network-idle waits are poor fits for pages with analytics, polling, WebSockets, advertisements, or other long-lived requests. If your task needs a rendered table, button, or application state, wait for that result explicitly rather than treating a lifecycle event as proof.
Rank #3
- Compact Mouse: With a comfortable and contoured shape, this Logitech ambidextrous wireless mouse feels great in either right or left hand and is far superior to a touchpad
- Durable and Reliable: This USB wireless mouse features a line-by-line scroll wheel, up to 1 year of battery life (2) thanks to a smart sleep mode function, and comes with the included AA battery
- Universal Compatibility: Your Logitech mouse works with your Windows PC, Mac, or laptop, so no matter what type of computer you own today or buy tomorrow your mouse will be compatible
- Plug and Play Simplicity: Just plug in the tiny nano USB receiver and start working in seconds with a strong, reliable connection to your wireless computer mouse up to 33 feet / 10 m (5)
- Better than touchpad: Get more done by adding M185 to your laptop; according to a recent study, laptop users who chose this mouse over a touchpad were 50% more productive (3) and worked 30% faster (4)
await page.goto(url, {
'waitUntil': 'domcontentloaded',
'timeout': 30000,
})
await page.waitForSelector('#results', {'visible': True, 'timeout': 30000})
Clicks that navigate
Start the navigation wait before, or concurrently with, the click. Otherwise the click can trigger navigation before your code begins listening:
Recommended Free Tools
await asyncio.gather(
page.waitForNavigation({'waitUntil': 'domcontentloaded'}),
page.click('a.next-page'),
)
Dynamic content and explicit conditions
Use waitForSelector() for an element and waitForFunction() for a measurable state such as a non-empty result count. Both have documented 30-second defaults. Verify that the selector exists in the current frame and that the function can become true; a perfect timeout setting cannot satisfy a condition that never occurs.
A minimal instrumented script
This example records versions and browser output, uses an explicit readiness condition, and closes resources in a predictable order:
import asyncio
import platform
import sys
import pyppeteer
from pyppeteer import launch
pyppeteer.DEBUG = True
async def main():
browser = None
try:
browser = await launch(
headless=True,
dumpio=True,
autoClose=False,
)
print('python:', sys.version)
print('platform:', platform.platform())
print('pyppeteer:', getattr(pyppeteer, '__version__', 'unknown'))
page = await browser.newPage()
page.setDefaultNavigationTimeout(30000)
page.on('requestfailed', lambda req: print(
'request failed:', req.url, req.failure
))
await page.goto(
'https://example.com',
{'waitUntil': 'domcontentloaded', 'timeout': 30000},
)
await page.waitForSelector('h1', {'timeout': 30000})
print(await page.title())
finally:
if browser is not None:
await browser.close()
asyncio.get_event_loop().run_until_complete(main())
Run the same script with the exact service account, container image, and environment used by the failing job. If Chromium exits, the forwarded browser log and the last successful line narrow the search far more effectively than a larger timeout.
Fixes matched to the evidence
The page is genuinely slow
After confirming that Chromium remains alive and the condition is correct, raise the specific wait or the default navigation timeout. Keep a finite application-level deadline so a stalled job is still cancelled and reported.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallOutdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchRank #4
- Computer mouse for easily navigating a computer interface; click, scroll, and more
- USB-A wired connection; if existing device only supports USB-C, an additional adapter will be required
- High-definition (1000 dpi) optical tracking ensures responsive cursor control for precise tracking and easy text selection
- 3 buttons offer effortless fingertip control
- Plug-and-go ready for instant use
The lifecycle event is wrong
Replace an unsuitable network-idle condition with domcontentloaded, load, a selector, or a function that represents the output you need. For a navigation-triggering click, pair waitForNavigation() with the click as shown above.
The target disappears
Look for premature cleanup, page reuse across concurrent coroutines, browser crashes, profile-directory collisions, and OS/container termination. Ensure each task owns a page or uses a lock, and that cleanup runs only after awaited work completes. Browser stderr is essential here.
The browser does not start reliably
Provision the documented Chromium revision with pyppeteer-install, check executable permissions and shared libraries, and temporarily remove custom flags and profiles. Compare bundled Chromium with the external executable only after the minimal launch works.
Troubleshooting table
| Symptom | Likely class | Evidence to collect | Targeted action |
|---|---|---|---|
TimeoutError from goto() |
Navigation condition expired | URL, waitUntil, elapsed time, request failures |
Choose the right lifecycle event or explicit selector; then adjust the finite timeout. |
TimeoutError from selector/function wait |
Condition never became true | Selector/frame, page HTML/state, preceding navigation | Correct the condition or page context before changing the deadline. |
Target closed |
Browser/page/target disappeared | Chromium stderr, exit status, launch options, last command | Fix process startup, premature close, resource limits, or compatibility; do not just increase timeout. |
| SSL, invalid-URL, or failed-main-resource error | Navigation failure, not necessarily a timeout | Original exception and failed request details | Correct the URL, certificate path, DNS/network, or server response. |
| Works locally, fails in CI | Environment or binary difference | OS image, browser revision, permissions, flags, stderr | Reproduce with the same image and bundled revision; change one launch variable. |
Should you migrate from Pyppeteer?
The Pyppeteer project maintainers write in the README, checked September 29, 2026: “This repo is unmaintained and has been outside of minor changes for a long time. Please consider playwright-python as an alternative.” That is a maintenance warning, not proof that migration will cure a particular crash. Before switching, compare the candidate library’s browser management, wait semantics, selectors, downloads, authentication, proxy handling, and error types in its own documentation, then port a small failing case and verify behavior in your deployment environment.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
When comparing a longer timeout, a different waitUntil, an external executable, or a migration, ask five questions: which failure class does it address; is the browser compatible with the documented revision; does it wait for the actual task condition; is the library maintained and supported; and do logs confirm the proposed cause?
Best Value
- 【Plug and Play for Home/Office/School】The wireless computer mouse features 2.4GHz connectivity, delivering a stable, interference-free connection up to 32ft. Designed for 𝐦𝐞𝐝𝐢𝐮𝐦 𝐭𝐨 𝐥𝐚𝐫𝐠𝐞 𝐬𝐢𝐳𝐞𝐝 𝐡𝐚𝐧𝐝𝐬, it ensures comfortable use all day. Simply plug in the USB-A receiver for instant pairing—no drivers needed. 📌📌 If the mouse isn’t suitable, place the USB receiver in the battery compartment and return both.
- 【3 Levels Adjustable DPI】This travel USB mouse offers 3 adjustable DPI settings (800, 1200, 1600), allowing you to customize sensitivity for precise design work. Effortlessly switch to match your task and elevate your productivity. 📌 Please remove the film at the bottom of the mouse before use.
- 【Effortless Browsing】Equipped with forward and backward buttons, this computer mice streamlines your workflow, making it easy to navigate through web pages and files with a simple click. 📌Side button does not work on Mac.
- 【Visible Indicator Light】 The pc mouse features a visual indicator for DPI levels and low battery alerts. The red light flashes once for 800 DPI, twice for 1200 DPI, and three times for 1600 DPI. When the battery level is below 10%, the light flashes red until the mouse is completely out of power.
- 【Click to Wake】With smart sleep mode, it saves power by standby after 10 inactive minutes, just 2-3 clicks to wake. This efficient design delivers 3x longer battery life than motion-wake mice. Engineered for durability, its buttons and scroll wheel are tested for 10 million clicks, ensuring long-term reliability and consistent performance.
Or skip the browser setup
If your goal is a reliable website image or PDF rather than controlling a browser session, ScreenshotNeo makes one API request and handles the capture service for you. The minimal cURL call is:
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 full parameter list and examples in the ScreenshotNeo documentation. 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}`);
Before capture, it accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be disabled. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed as clean shots, and response headers report the page verdict and billing status. It also provides an MCP server for Claude, Cursor, and other MCP clients, with take_screenshot, get_page_info, and capture_pdf tools. The Free plan includes 1,000 shots per month without a card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errorsFrequently Asked Questions
Can I disable every Pyppeteer timeout?
Individual waits accept timeout=0, but an external deadline and cancellation policy are safer than allowing a stuck browser job to run indefinitely.
Is headless mode the cause of every Target closed error?
No. One reported issue used headless=False, but that single report does not establish a general cause. Verify the executable, launch environment, process exit, and browser logs.
What should I archive for a bug report?
Include the full traceback, browser stdout and stderr, Python/Pyppeteer/Chromium versions, OS or container details, exact launch options, URL, last operation, and whether Chromium exited.
Quick Recap
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.

