← Back to Page domain

Page.handleJavaScriptDialog

Accepts or dismisses a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload).

Domain: Page stable

Parameters

NameTypeDescription
acceptbooleanWhether to accept or dismiss the dialog.
promptText (optional)stringThe text to enter into the dialog prompt before accepting. Used only if this is a prompt dialog.

Example Request

{
  "id": 1,
  "method": "Page.handleJavaScriptDialog",
  "params": {
    "accept": true
  }
}

Example Response

{
  "id": 1,
  "result": {}
}

Usage in Node.js

const result = await send('Page.handleJavaScriptDialog', {"accept": true});
console.log(result);