# Class AlertPromise

Implement AlertPromise

#### Hierarchy

- Promise<Alert>
- Alert
  - AlertPromise

#####
Index

### Constructors

constructor

### Properties

[toStringTag]

### Methods

accept
authenticateAs
catch
dismiss
finally
getText
sendKeys
then

## Constructors

### constructor

- new AlertPromise(driver, alert): AlertPromise

- #### Parameters

  - ##### driver: WebDriver

    The driver controlling the browser this alert is attached to.

  - ##### alert: Promise<Alert>

    A thenable that will be fulfilled with the promised alert.

  #### Returns AlertPromise

  Inherited from Alert.constructor

## Properties

### `Readonly` [toStringTag]

[toStringTag]: string

Inherited from Promise.[toStringTag]

## Methods

### accept

- accept(): Promise<void>

- Accepts this alert.

  #### Returns Promise<void>

  A promise that will be resolved when this command has completed.

  Inherited from Alert.accept

### authenticateAs

- authenticateAs(username, password): Promise<void>

- Sets the username and password in an alert prompting for credentials (such as a Basic HTTP Auth prompt). This method will implicitly #accept() submit the dialog.

  #### Parameters

  - ##### username: string

    The username to send.

  - ##### password: string

    The password to send.

  #### Returns Promise<void>

  A promise that will be resolved when this command has completed.

  Inherited from Alert.authenticateAs

### catch

- catch<TResult>(onrejected?): Promise<Alert | TResult>

- Attaches a callback for only the rejection of the Promise.

  #### Type Parameters

  - #### TResult = never

  #### Parameters

  - ##### `Optional` onrejected: null | ((reason) => TResult | PromiseLike<TResult>)

    The callback to execute when the Promise is rejected.

  #### Returns Promise<Alert | TResult>

  A Promise for the completion of the callback.

  Inherited from Promise.catch

### dismiss

- dismiss(): Promise<void>

- Dismisses this alert.

  #### Returns Promise<void>

  A promise that will be resolved when this command has completed.

  Inherited from Alert.dismiss

### finally

- finally(onfinally?): Promise<Alert>

- Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The resolved value cannot be modified from the callback.

  #### Parameters

  - ##### `Optional` onfinally: null | (() => void)

    The callback to execute when the Promise is settled (fulfilled or rejected).

  #### Returns Promise<Alert>

  A Promise for the completion of the callback.

  Inherited from Promise.finally

### getText

- getText(): Promise<string>

- Retrieves the message text displayed with this alert. For instance, if the alert were opened with alert('hello'), then this would return 'hello'.

  #### Returns Promise<string>

  A promise that will be resolved to the text displayed with this alert.

  Inherited from Alert.getText

### sendKeys

- sendKeys(text): Promise<void>

- Sets the response text on this alert. This command will return an error if the underlying alert does not support response text (e.g. window.alert and window.confirm).

  #### Parameters

  - ##### text: string

    The text to set.

  #### Returns Promise<void>

  A promise that will be resolved when this command has completed.

  Inherited from Alert.sendKeys

### then

- then<TResult1, TResult2>(onfulfilled?, onrejected?): Promise<TResult1 | TResult2>

- Attaches callbacks for the resolution and/or rejection of the Promise.

  #### Type Parameters

  - #### TResult1 = Alert

  - #### TResult2 = never

  #### Parameters

  - ##### `Optional` onfulfilled: null | ((value) => TResult1 | PromiseLike<TResult1>)

    The callback to execute when the Promise is resolved.

  - ##### `Optional` onrejected: null | ((reason) => TResult2 | PromiseLike<TResult2>)

    The callback to execute when the Promise is rejected.

  #### Returns Promise<TResult1 | TResult2>

  A Promise for the completion of which ever callback is executed.

  Inherited from Promise.then

Generated using TypeDoc