Set a timeout on the locator before calling its action: await page.locator('button').setTimeout(3000).click(); The value is in milliseconds. setTimeout() returns a new locator configured with that timeout; use 0 to disable the locator timeout. Locators otherwise inherit the page’s default timeout.
Set a timeout for one locator
Call .setTimeout(milliseconds) before the locator action. For example, give a submit button up to 10 seconds to become ready and click:
As an Amazon Associate I earn from qualifying purchases.
await page.locator('button.submit').setTimeout(10_000).click();
The timeout applies to the action on that configured locator. The value is measured in milliseconds. Puppeteer documents 3000 as an example; it is not a universal recommendation. Choose a limit that fits the page’s expected behavior, and investigate a timeout rather than simply making every wait longer.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Runnable example
With Puppeteer installed in a Node.js project, this example opens a page, configures a locator timeout, and attempts a click. Replace the URL and selector with ones for the page you control.
#1 Best Overall
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
try {
const page = await browser.newPage();
await page.goto('https://example.com');
await page.locator('button.submit').setTimeout(10_000).click();
} finally {
await browser.close();
}
})();
The example assumes that the target page has a matching button.submit and that it can be clicked. A locator timeout cannot make a missing element or an incorrect selector succeed.
Choose between a locator timeout and a page default
Use a locator override when one action needs a different limit. Use page.setDefaultTimeout(milliseconds) when locators on that page should share a default. Locators without their own timeout inherit the page setting.
Rank #2
| Setting | Scope | Example |
|---|---|---|
| Locator override | That configured locator’s action | page.locator('button.submit').setTimeout(10_000).click() |
| Page default | Default timeout inherited by locators on the page | page.setDefaultTimeout(5000) |
| Disable locator timeout | That configured locator | page.locator('button').setTimeout(0).click() |
page.setDefaultTimeout(5000);
// This locator has its own 10-second timeout.
await page.locator('button.submit').setTimeout(10_000).click();
// This locator inherits the page's 5-second default.
await page.locator('button.cancel').click();
Locator.setTimeout() returns a new locator instance, so keep and use the returned locator in the action chain. Setting a locator timeout is not the same as configuring navigation timeouts; this setting does not change how long navigation is allowed to take.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errorsWhat a locator timeout waits for
A locator action waits for the element and for the action’s readiness conditions. For a click, those conditions include being in the viewport, visible and enabled, with a stable bounding box. If the element is not found or the required state is not reached before the timeout, Puppeteer throws a TimeoutError. Locator actions retry when readiness checks fail.
Increasing the timeout helps only when the page is expected to reach the required state but needs more time. It does not correct a selector that matches nothing or a readiness assumption that does not fit the page.
Troubleshoot a locator timeout
- The selector does not match: Check the selector against the page’s actual DOM and confirm the element exists in the context where the locator is used.
- The element appears but the action still times out: Check the action’s readiness requirements. For a click, confirm the element becomes visible, enabled, in the viewport and stable.
- Only one control is slow: Set a longer timeout on that locator rather than changing the page default for every locator.
- Many locators need a different shared limit: Set
page.setDefaultTimeout(milliseconds)and use locator-specific overrides only for exceptions. - You are considering
setTimeout(0): This disables the locator timeout rather than fixing the cause of a wait. Prefer a finite limit unless an unbounded wait is intentional. - The wait concerns navigation: A locator timeout configures locator actions, not navigation. Use the separate navigation-timeout API for navigation behavior.
Or skip the browser setup
If the goal is to capture a website rather than interact with it in Puppeteer, ScreenshotNeo can return a screenshot from one GET request. For example, save a WebP screenshot of the target URL:
Rank #4
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
See the ScreenshotNeo documentation for request options. Cookie banners, popups and chat widgets are removed before the shot; bot checks, blank pages and failed loads are never billed. Its MCP server lets AI agents take screenshots. The free plan includes 1,000 screenshots a month with no card, and paid plans start at $5 for 3,000 shots.
Sign up for 1,000 free screenshots a month, with no card required.
Quick Recap
Best Value
- Used Book in Good Condition
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.




