public void ShouldThrowAnExceptionIfAnAlertHasNotBeenDealtWith()
{
driver.Url = alertsPage;
driver.FindElement(By.Id("alert")).Click();
IAlert alert = driver.SwitchTo().Alert();
try
{
string title = driver.Title;
}
catch (InvalidOperationException)
{
// this is an expected exception
}
// but the next call should be good.
Assert.AreEqual("Testing Alerts", driver.Title);
}