# defaultValue

If dialog is prompt, returns default prompt value. Otherwise, returns empty string.

info

Only works with browser dialogs (via BiDi protocol). Native mobile dialogs do not expose a default value 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.defaultValue()
```

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

dialogDefaultValue.js

```
// Listen for the dialog event to get the dialog object
browser.on('dialog', async (dialog) => {
    if (dialog.type() === 'prompt') {
        const value = await dialog.defaultValue();
        console.log(value); // prints the default prompt value
    }
});
```

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

* **\<string>** **`returns`:** The default prompt value, or empty string if not a prompt.
