(Created on )

Puppeteer: No element found for selector: {value}

A page action/query requires a selector that currently matches no element.


A page action/query requires a selector that currently matches no element.

Error message

No element found for selector: {value}

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

How this error happens

A direct page action does not wait for a missing element to appear. Here, the requested selector does not match the demo page.

The snippets use an open Puppeteer page named page.

await page.setContent(
    '<button id="save">Save</button>'
);

await page.click(
    "#submit"
);

How to fix

Correct the selector and wait for the intended control to be actionable.

await page.locator("#save").click();

Things to keep in mind

A longer timeout will not fix a misspelled selector. For an iframe, query the frame that owns the element.

All Puppeteer errors

Keep Reading

Puppeteer Guides

All Guides →