Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Repair Windows errors before they cause bigger problems3Scan for outdated or missing drivers - takes under a minuteSet a timeout on the locator before calling its action: await page.locator('button').setTimeout(3000).click(); The value is in milliseconds. setTimeout() returns a locator configured with that action timeout; use 0 to disable it. Without an override, a locator inherits the page’s default timeout.
Set a timeout for one locator action
Call .setTimeout(milliseconds) on the locator, then call the action you want it to perform:
await page.locator('button.submit').setTimeout(10_000).click();
This gives that locator action up to 10,000 milliseconds (10 seconds) to satisfy the action’s requirements. The Puppeteer guide’s 3,000-millisecond example is an illustration, not a universal recommended timeout. Choose a limit that fits the page and action you are automating.
setTimeout() returns a new, cloned locator with the timeout configured. Chain the action from that returned locator, as in the examples, rather than expecting the original locator to be changed. See the Locator.setTimeout API reference.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
#1 Best Overall
What the locator timeout waits for
Locator actions wait for the target and relevant action preconditions to become ready. For a click, those checks include whether the element is present, visible, enabled, in the viewport, and has a stable bounding box. If the element cannot be found or the readiness checks keep failing until the timeout expires, Puppeteer throws a TimeoutError. Locator operations retry when readiness checks fail. The Puppeteer page interactions guide describes locator actions and their preconditions.
A longer timeout can help when a legitimate page transition takes more time, but it will not fix an incorrect selector or an action that can never become ready. Check those first. Avoid setting the timeout to zero simply to hide a slow or failing action: that disables timeout enforcement rather than addressing its cause.
Rank #2
Choose between a locator timeout and a page default
Use a locator override for an action that needs more or less time than the rest of the page. Use page.setDefaultTimeout(milliseconds) when you want to change the default inherited by locators that have no override.
| Setting | Scope | Example |
|---|---|---|
locator.setTimeout(milliseconds) |
The locator on which it is called, for its actions | page.locator('button.submit').setTimeout(10_000).click() |
page.setDefaultTimeout(milliseconds) |
Page default inherited by locators without their own timeout | page.setDefaultTimeout(5000) |
For example, set a 5-second page default and give only a slower submit action 10 seconds:
page.setDefaultTimeout(5000);
// This action uses its own 10-second timeout.
await page.locator('button.submit').setTimeout(10_000).click();
// This locator inherits the 5-second page default.
await page.locator('button.cancel').click();
The Page.setDefaultTimeout API reference documents the page setting. It is distinct from Puppeteer’s navigation timeout APIs: changing a locator timeout does not configure navigation timeouts.
Disable a locator timeout
Pass 0 to disable timeout enforcement for the locator action:
Rank #4
await page.locator('button.submit').setTimeout(0).click();
This removes the timeout limit; it does not make the element appear or satisfy action preconditions. Use it only when an unbounded wait is intentional and the surrounding automation has another way to detect or stop a stalled operation.
Troubleshoot locator timeouts
- The selector does not match. Confirm that the target exists in the page and that the selector identifies the intended element. A longer timeout cannot make a wrong selector succeed.
- The element appears but the action still times out. Check the action’s readiness requirements. For a click, verify that the element becomes visible, enabled, in the viewport, and stable enough to click.
- Only one action is slow. Set a longer timeout on that locator instead of raising the page default for every locator.
- Many locators need more time. Consider adjusting
page.setDefaultTimeout(milliseconds), then use per-locator overrides where an action needs a different limit. - The operation waits indefinitely. Check whether the locator uses
setTimeout(0); zero disables that timeout. - A navigation is timing out. A locator timeout is not a navigation timeout. Configure the relevant navigation timeout separately.
Or skip the browser setup
If your goal is a screenshot rather than browser interaction, ScreenshotNeo can return one with a single GET request. Its screenshot API removes cookie and consent banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, and failed loads are not billed. It also offers an MCP server for AI agents. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 shots. See the ScreenshotNeo documentation.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Sign up for 1,000 free screenshots a month with no card.
Best Value
- Used Book in Good Condition
Frequently Asked Questions
What unit does Puppeteer Locator.setTimeout() use?
Milliseconds.
What happens when I pass 0 to Locator.setTimeout()?
It disables timeout enforcement for that locator action.
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.

