(Created on )

Puppeteer: Element is not a <select> element.

select is called on a node that is not an HTMLSelectElement.


select is called on a node that is not an HTMLSelectElement.

Error message

Element is not a <select> element.

How this error happens

select only works on native HTML <select> elements. A text input or custom dropdown is not a select element.

The snippets use an open Puppeteer page named page.

await page.setContent(
    '<input id="quantity" value="2">'
);

await page.select(
    "#quantity",
    "2"
);

How to fix

Use the appropriate operation for the actual control. For this text input, fill its value.

await page.locator("#quantity").fill(
    "2"
);

Things to keep in mind

For a custom dropdown, open it and click the intended option instead of using select.

All Puppeteer errors

Keep Reading

Puppeteer Guides

All Guides →