I am currently using Selenium WebDriverWait
to wait for things to happend where I don't need the IWebDriver
functionality. My code looks like this:
public static T WaitForNotNull<T>(this IWebDriver driver, Func<T> func)
{
var result = default(T);
var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
wait.Until(d => (result = func()) != null);
return result;
}
public static void WaitForNull<T>(this IWebDriver driver, Func<T> func)
{
var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
wait.Until(d => func() == null);
}
Is there a similar construct in .Net which I can use instead of WebDriverWait?
The answer is
There is no such thing in the .NET Framework, you will have to write such a method yourself.