Skip to content

Instantly share code, notes, and snippets.

@deanhume
Created October 26, 2011 16:45
Show Gist options
  • Save deanhume/1316944 to your computer and use it in GitHub Desktop.
Save deanhume/1316944 to your computer and use it in GitHub Desktop.
Selenium Webdriver Implicit Wait
[Test]
public void Search_ShouldReturn_CorrectRestaurantName_WithImplicitWait()
{
_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 autocomplete to wait - Implicit Wait
_driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(4));
// Test the autocomplete response
IWebElement autocomplete = _driver.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