# accept

Accepts the dialog and returns when the dialog has been handled.

info

Only works with browser dialogs (via BiDi protocol). For mobile native dialogs, use [`browser.acceptDialog`](/docs/api/mobile/acceptDialog.md) instead.

## Usage[​](#usage "Direct link to Usage")

```
await dialog.accept(promptText)
```

## Parameters[​](#parameters "Direct link to Parameters")

| Name                         | Type     | Details                                                                                     |
| ---------------------------- | -------- | ------------------------------------------------------------------------------------------- |
| `promptText`<br />*optional* | `string` | A text to enter into prompt. Does not cause any effects if the dialog's type is not prompt. |

## Example[​](#example "Direct link to Example")

dialogAccept.js

```
// Listen for the dialog event to get the dialog object
browser.on('dialog', async (dialog) => {
    console.log(dialog.message()); // prints: 'Hello, world!'
    await dialog.accept();
});

// Or accept a prompt dialog with text
browser.on('dialog', async (dialog) => {
    if (dialog.type() === 'prompt') {
        await dialog.accept('my input');
    }
});
```
