public void GetAlertTextTest() { 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 Alert']")); var text = elementActions.GetAlertText(); Assert.AreEqual("I am a JS Alert", text, "The alert text didn't match."); }