public void ClearIWebElementTest() { var elementActions = new ElementActions(Driver); Driver.Url = "http://the-internet.herokuapp.com/"; elementActions.Click(Driver.FindElement(By.XPath("//a[text()='Forgot Password']"))); elementActions.Type(Driver.FindElement(By.XPath("//input[@id='email']")), "james"); elementActions.Clear(Driver.FindElement(By.XPath("//input[@id='email']"))); Assert.AreEqual(string.Empty, Driver.FindElement(By.Id("email")).GetAttribute("value"), "The textbox values didn't match."); }
public void ClearByTest() { var elementActions = new ElementActions(Driver); Driver.Url = "http://the-internet.herokuapp.com/"; MyLogger.Log.Info("went to a url"); elementActions.Click(Driver.FindElement(By.XPath("//a[text()='Forgot Password']"))); MyLogger.Log.Info("clicked a thing"); new WebDriverWait(Driver, TimeSpan.FromSeconds(30)).Until(ExpectedConditions.ElementIsVisible(By.XPath("//input[@id='email']"))); elementActions.Type(By.XPath("//input[@id='email']"), "james"); MyLogger.Log.Info("entered james"); elementActions.Clear(By.XPath("//input[@id='email']")); MyLogger.Log.Info("cleared a thing"); Assert.AreEqual(string.Empty, Driver.FindElement(By.Id("email")).GetAttribute("value"), "The textbox values didn't match."); }