2022-07-05 13:41:43 +00:00
---
sidebar_label: Dialog
---
# Dialog class
Dialog instances are dispatched by the [Page ](./puppeteer.page.md ) via the `dialog` event.
2022-10-24 07:07:05 +00:00
#### Signature:
2022-07-05 13:41:43 +00:00
```typescript
2023-09-12 09:24:09 +00:00
export declare abstract class Dialog
2022-07-05 13:41:43 +00:00
```
## 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
```ts
2022-12-09 12:57:39 +00:00
import puppeteer from 'puppeteer';
2022-07-05 13:41:43 +00:00
(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
2024-03-20 15:03:14 +00:00
< table > < thead > < tr > < th >
Method
< / th > < th >
Modifiers
< / th > < th >
Description
< / th > < / tr > < / thead >
< tbody > < tr > < td >
2024-04-11 11:01:13 +00:00
< span id = "accept" > [accept(promptText)](./puppeteer.dialog.accept.md)< / span >
2024-03-20 15:03:14 +00:00
< / td > < td >
< / td > < td >
A promise that resolves when the dialog has been accepted.
< / td > < / tr >
< tr > < td >
2024-04-11 11:01:13 +00:00
< span id = "defaultvalue" > [defaultValue()](./puppeteer.dialog.defaultvalue.md)< / span >
2024-03-20 15:03:14 +00:00
< / td > < td >
< / td > < td >
The default value of the prompt, or an empty string if the dialog is not a `prompt` .
< / td > < / tr >
< tr > < td >
2024-04-11 11:01:13 +00:00
< span id = "dismiss" > [dismiss()](./puppeteer.dialog.dismiss.md)< / span >
2024-03-20 15:03:14 +00:00
< / td > < td >
< / td > < td >
A promise which will resolve once the dialog has been dismissed
< / td > < / tr >
< tr > < td >
2024-04-11 11:01:13 +00:00
< span id = "message" > [message()](./puppeteer.dialog.message.md)< / span >
2024-03-20 15:03:14 +00:00
< / td > < td >
< / td > < td >
The message displayed in the dialog.
< / td > < / tr >
< tr > < td >
2024-04-11 11:01:13 +00:00
< span id = "type" > [type()](./puppeteer.dialog.type.md)< / span >
2024-03-20 15:03:14 +00:00
< / td > < td >
< / td > < td >
The type of the dialog.
< / td > < / tr >
< / tbody > < / table >