(Created on )

Puppeteer: Waiting failed: {value}ms exceeded

waitForFunction/selector's WaitTask exceeded its configured deadline.


waitForFunction/selector’s WaitTask exceeded its configured deadline.

Error message

Waiting failed: {value}ms exceeded

{value} is replaced by the value shown in your error message.

How this error happens

A wait times out when its condition never becomes true. This demo expects a #ready element that the page never creates.

The snippets use an open Puppeteer page named page.

await page.setContent(
    "<p>Loading</p>"
);

await page.waitForFunction(
    () => document.querySelector("#ready") !== null,
    {
        timeout: 500,
    }
);

How to fix

Wait for a condition that the application actually reaches. The demo below provides the intended ready state.

await page.setContent(
    '<p id="ready">Ready</p>'
);

await page.waitForFunction(
    () => document.querySelector("#ready") !== null,
    {
        timeout: 5000,
    }
);

Things to keep in mind

In production, diagnose missing data, failed requests, incorrect selectors or the wrong frame. Raising the timeout only helps when the condition genuinely needs more time.

All Puppeteer errors

Keep Reading

Puppeteer Guides

All Guides →