An NDoc Documented Class Library |

# DefaultSelenium.GetAlert Method

Retrieves the message of a JavaScript alert generated during the previous action, or fail if there were no alerts.

Getting an alert has the same effect as manually clicking OK. If an alert is generated but you do not get/verify it, the next Selenium action will fail.

NOTE: under Selenium, JavaScript alerts will NOT pop up a visible alert dialog.

NOTE: Selenium does NOT support JavaScript alerts that are generated in a page's onload() event handler. In this case a visible dialog WILL be generated and Selenium will hang until someone manually clicks OK.

public string GetAlert();

#### Return Value

The message of the most recent JavaScript alert

#### Implements

ISelenium.GetAlert

#### See Also

DefaultSelenium Class | Selenium Namespace