Puppeteer: Element cannot be filled out.
Locator.fill targets a node that cannot be filled.
Locator.fill targets a node that cannot be filled.
Error message
Element cannot be filled out.
How this error happens
Locator.fill needs a fillable input, textarea, select, or contenteditable element. A button cannot be filled with text.
The snippets use an open Puppeteer page named page.
await page.setContent(
'<button id="save">Save</button>'
);
await page.locator("#save").fill(
"New label"
);
The locator raises this error internally for a non-fillable node. Locator retries can eventually expose a timeout instead of the underlying message.
How to fix
Target the field that accepts the value. Use click if the intended operation is pressing the button.
await page.setContent(
'<input id="title"><button id="save">Save</button>'
);
await page.locator("#title").fill(
"New title"
);
await page.locator("#save").click();
Things to keep in mind
Changing a button label is a DOM update, not a form-filling operation.