public void Search() { driver.Navigate().GoToUrl("http://google.com/ncr"); driver.FindElement(By.Name("q")).SendKeys("Selenide" + Keys.Enter); /* * new WebDriverWait(driver, TimeSpan.FromSeconds(2)) * .Until( * ExpectedConditions.TextToBePresentInElement( * new GooglePage(driver).Results[0], * "Selenide: concise UI tests in Java" * ) * ); */ new WebDriverWait(driver, TimeSpan.FromSeconds(2)) .Until( CustomConditions.ListNthElementHasText( new GooglePage(driver).Results, 0, "Selenide: concise UI tests in Java" ) ); driver.FindElements(By.CssSelector(".srg>.g"))[0] .FindElement(By.CssSelector("h3>a")).Click(); new WebDriverWait(driver, TimeSpan.FromSeconds(2)).Until( ExpectedConditions.UrlToBe("http://selenide.org/")); }
public void Search() { driver.Navigate().GoToUrl("http://google.com/ncr"); driver.FindElement(By.Name("q")).SendKeys("Selenide" + Keys.Enter); new WebDriverWait(driver, TimeSpan.FromSeconds(2)) .Until( CustomConditions.ListNthElementHasText( new GooglePage(driver).Results, 0, "Selenide: concise UI tests in Java" ) ); }