Dialog class

Dialog objects are dispatched by page via the 'onDialog' event.

An example of using Dialog class:

var browser = await puppeteer.launch();
var page = await browser.newPage();
page.onDialog.listen((dialog) async {
  print(dialog.message);
  await dialog.dismiss();
});
await page.evaluate("() => alert('1')");
await browser.close();

Constructors

Dialog(Page page, JavascriptDialogOpeningEvent _openingEvent)

Properties

defaultValue String?
If dialog is prompt, returns default prompt value. Otherwise, returns empty string.
no setter
hashCode int
The hash code for this object.
no setterinherited
message String?
A message displayed in the dialog.
no setter
page Page
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
type DialogType
Dialog's type, can be one of alert, beforeunload, confirm or prompt.
no setter

Methods

accept({String? promptText}) Future<void>
promptText: A text to enter in prompt. Does not cause any effects if the dialog's type is not prompt.
dismiss() Future<void>
Returns Future which resolves when the dialog has been dismissed.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited