Puppeteer: Unknown key
The requested keyboard key identifier is unknown to Puppeteer's CDP or WebDriver BiDi implementation.
The requested keyboard key identifier is unknown to Puppeteer’s CDP or WebDriver BiDi implementation.
Error message
Unknown key: '{value}'
{value} is replaced by the value shown in your error message.
How this error happens
keyboard.press, down and up accept key identifiers, not whole words. submit is not a key name in either CDP or WebDriver BiDi.
The snippets use an open Puppeteer page named page.
await page.keyboard.press(
"submit"
);
How to fix
Use the actual key identifier, or use type to enter a string of text.
await page.keyboard.press(
"Enter"
);
Things to keep in mind
This article covers the CDP and BiDi variants of the message. Key support is not identical across protocols; test special keys with the browser you use.