public void DismissAlertTest() { var elementActions = new ElementActions(Driver); Driver.Url = "http://the-internet.herokuapp.com/"; elementActions.Click(By.XPath("//a[text()='JavaScript Alerts']")); elementActions.Click(By.XPath("//button[text()='Click for JS Confirm']")); Assert.IsTrue(elementActions.IsAlertDisplayed(), "Alert wasn't displayed."); elementActions.DismissAlert(); Assert.IsFalse(elementActions.IsAlertDisplayed(), "Alert was still displayed."); }