public static void WaitAjax() { if (WebDriver != null) { var ready = new Func <bool>(() => (bool)((IJavaScriptExecutor)Browser.webDriver).ExecuteScript("return (typeof($) === 'undefined') ? true : !$.active;")); Contract.Assert(WaitHelper.SpinWait(ready, TimeSpan.FromSeconds(60), TimeSpan.FromMilliseconds(100))); } }
public static bool SpinWait(Func <bool> condition, TimeSpan timeout, TimeSpan pollingInterval) { return(WaitHelper.WithTimeout(timeout, pollingInterval).WaitFor(condition).IsSatisfied); }