(Created on )

Puppeteer: Unknown javascript dialog type: {value}

The browser reported a dialog type outside alert/confirm/prompt/beforeunload.


The browser reported a dialog type outside alert/confirm/prompt/beforeunload.

Error message

Unknown javascript dialog type: {value}

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

How this error happens

The browser reported a dialog type outside alert, confirm, prompt and beforeunload. A custom transport or incompatible protocol event can supply an invalid type.

The failing block is protocol event data; the correction uses an open page named page.

{
    "type": "custom-dialog",
    "message": "Continue?"
}

How to fix

Use a compatible browser and normal dialog events. Handle the public Dialog object once instead of synthesizing protocol dialog types.

page.once("dialog", async (dialog) => {
    console.log(dialog.type());

    await dialog.accept();
});

await page.evaluate(() => {
    alert("Continue?");
});

Things to keep in mind

The JSON block illustrates invalid event data. An HTML modal or a normal alert cannot manufacture an unknown native dialog type. If valid browser events still trigger the error, isolate the browser or transport failure.

All Puppeteer errors

Keep Reading

Puppeteer Guides

All Guides →