(Created on )

Puppeteer: Selector {value} is too long

An ARIA selector exceeds 10,000 characters.


An ARIA selector exceeds 10,000 characters.

Error message

Selector {value} is too long

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

How this error happens

The ARIA selector parser limits selector length. Inserting a large document or payload into the accessible-name selector exceeds that limit.

The snippets use an open Puppeteer page named page.

const longName = "x".repeat(10001);

await page.$(
    "aria/" + longName
);

How to fix

Use a short, meaningful accessible name or a stable CSS selector. Do not build selectors from an entire page’s text.

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

const save = await page.$(
    '[data-testid="save"]'
);

await save.click();

Things to keep in mind

Truncating an arbitrary name can select the wrong element. Choose a unique locator instead.

All Puppeteer errors

Keep Reading

Puppeteer Guides

All Guides →