puppeteer/website/versioned_docs/version-18.0.5/api/puppeteer.dialog.md
release-please[bot] ddc567a4b6
chore(main): release 18.0.5 (#8997)
* chore(main): release 18.0.5

* chore: generate versioned docs

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
2022-09-22 10:46:01 +02:00

1.3 KiB

sidebar_label
Dialog

Dialog class

Dialog instances are dispatched by the Page via the dialog event.

Signature:

export declare class Dialog

Remarks

The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the Dialog class.

Example

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch();
  const page = await browser.newPage();
  page.on('dialog', async dialog => {
    console.log(dialog.message());
    await dialog.dismiss();
    await browser.close();
  });
  page.evaluate(() => alert('1'));
})();

Methods

Method Modifiers Description
accept(promptText)
defaultValue()
dismiss()
message()
type()