# message

A message displayed in the dialog.

info

Only works with browser dialogs (via BiDi protocol). Native mobile dialogs do not expose their message through WebDriver. Use [`browser.acceptDialog`](/docs/api/mobile/acceptDialog.md) or [`browser.dismissDialog`](/docs/api/mobile/dismissDialog.md) to handle them.

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

```
await dialog.message()
```

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

dialogMessage.js

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

## Returns[​](#returns "Direct link to Returns")

* **\<string>** **`returns`:** The message displayed in the dialog.
