Created
October 26, 2011 16:40
-
-
Save deanhume/1316935 to your computer and use it in GitHub Desktop.
Selenium Webdriver Explicit Wait
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Test] | |
public void Search_ShouldReturn_CorrectRestaurantName_WithExplicitWait() | |
{ | |
_driver.Navigate().GoToUrl("http://www.bookatable.com/"); | |
// Find the search box and type some text | |
IWebElement searchBox = _driver.FindElement(By.Name("ddRestaurants")); | |
searchBox.Click(); | |
searchBox.SendKeys("or"); | |
// Tell webdriver to wait | |
WebDriverWait wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(4)); | |
// Test the autocomplete response - Explicit Wait | |
IWebElement autocomplete = wait.Until(x => x.FindElement(By.ClassName("ac-row-110457"))); | |
string autoCompleteResults = autocomplete.Text; | |
Assert.That(autoCompleteResults, Is.EqualTo("A la cloche d'Or\r\nParis, France")); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment