Represents a modal dialog such as {@code alert}, {@code confirm}, or {@code prompt}. Provides functions to retrieve the message displayed with the alert, accept or dismiss the alert, and set the response text (in the case of {@code prompt}).

Hierarchy

Constructors

  • Parameters

    • driver: WebDriver

      The driver controlling the browser this alert is attached to.

    • text: string

      The message text displayed with this alert.

    Returns Alert

Methods

  • Accepts this alert.

    Returns Promise<void>

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

  • 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.

  • Dismisses this alert.

    Returns Promise<void>

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

  • 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.

  • 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.

Generated using TypeDoc