(Created on )

Puppeteer: Unknown aria attribute '{value}' in selector

Puppeteer's ARIA selector uses an attribute other than its supported name/role fields.


Puppeteer’s ARIA selector uses an attribute other than its supported name/role fields.

Error message

Unknown aria attribute '{value}' in selector

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

How this error happens

Puppeteer’s ARIA selector recognizes name and role. It is not a general CSS attribute selector.

The snippets use an open Puppeteer page named page.

await page.setContent(
    '<button aria-label="Save">Save</button>'
);

await page.$(
    'aria/Save[title="Save"]'
);

How to fix

Use the supported accessible-name and role syntax, or use a CSS selector for literal HTML attributes.

const save = await page.$(
    'aria/Save[role="button"]'
);

await save.click();

Things to keep in mind

The accessible name is calculated by the browser. It is not always the element’s visible text.

All Puppeteer errors

Keep Reading

Puppeteer Guides

All Guides →