Class webdriver.Alert
Extends
.
Defined in: webdriver.js.
Constructor Attributes | Constructor Name and Description |
---|---|
webdriver.Alert(driver, text)
Represents a modal dialog such as {@code alert}, {@code confirm}, or
{@code prompt}.
|
Method Attributes | Method Name and Description |
---|---|
accept()
Accepts this alert.
|
|
dismiss()
Dismisses this alert.
|
|
getText()
Retrieves the message text displayed with this alert.
|
|
sendKeys(text)
Sets the response text on this alert.
|
Class Detail
webdriver.Alert(driver, text)
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}).
- Parameters:
- {!webdriver.WebDriver} driver
- The driver controlling the browser this alert is attached to.
- {!(string|webdriver.promise.Promise)} text
- Either the message text displayed with this alert, or a promise that will be resolved to said text.
Method Detail
{!webdriver.promise.Promise}
accept()
Accepts this alert.
- Returns:
- {!webdriver.promise.Promise} A promise that will be resolved when this command has completed.
{!webdriver.promise.Promise}
dismiss()
Dismisses this alert.
- Returns:
- {!webdriver.promise.Promise} A promise that will be resolved when this command has completed.
{!webdriver.promise.Promise}
getText()
Retrieves the message text displayed with this alert. For instance, if the
alert were opened with alert("hello"), then this would return "hello".
- Returns:
- {!webdriver.promise.Promise} A promise that will be resolved to the text displayed with this alert.
{!webdriver.promise.Promise}
sendKeys(text)
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:
- {string} text
- The text to set.
- Returns:
- {!webdriver.promise.Promise} A promise that will be resolved when this command has completed.