public void AcceptAlertTest() { 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.AcceptAlert(); Assert.IsFalse(elementActions.IsAlertDisplayed(), "Alert was still displayed."); }