at first:
- Selenium 2.0 with Webdriver
- for IExplorer, Chrome and Firefox
- current Webdriver and Selenium dll's
- Windows 8.1
- Visual Studio 2013 C#
i would test my site. The pages will be loaded with ajax. If i would change the page, it will be display a loading div (div #wartenDialog). Now i would wait while display this div, before i change to next page.
the problem is, sometimes there is a small delay until show loading div and by a fast computer/internet there is no loading div.
i have try this functions:
public static void WaitWhileElementVisible(RemoteWebDriver _driver, By _locator)
{
WebDriverWait wait = new WebDriverWait(_driver, TimeSpan.FromMilliseconds(timeout));
wait.Until(drv => !Exists(drv, _locator));
}
private static bool Exists(IWebDriver _drv, By _locator)
{
return (ExpectedConditions.ElementIsVisible(_locator) != null);
}
Now it's always run in Timeout.
WaitWhileElementVisiblewith parameters. Also I do not understand why you create customExistsmethod with parameterIWebDriver _drvthat is not used at all. - Vojtěch Dohnal