(Created on )

Puppeteer: Cannot poll with non-positive interval

A numeric polling interval is negative.


A numeric polling interval is negative.

Error message

Cannot poll with non-positive interval

How this error happens

A negative numeric polling interval is invalid. This often happens when a duration calculation produces a negative result.

The snippets use an open Puppeteer page named page.

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

How to fix

Use a positive interval, or choose raf or mutation polling to match what you are waiting for.

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

Things to keep in mind

The corrected options do not create #ready. The page must still reach the condition before the timeout.

All Puppeteer errors

Keep Reading

Puppeteer Guides

All Guides →