title: Webdriver Wait until Ajax loader is finished loading
body: <p><a href="https://i.stack.imgur.com/AZ5oX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AZ5oX.png" alt="enter image description here"></a></p>
  
  <p>I am using the below for waiting until the ajax loader is finished loading </p>
  
  <pre><code>var wait = new WebDriverWait(BrowserFactory.Driver, TimeSpan.FromSeconds(60));
  wait.Until(d =&gt; (bool) (d as IJavaScriptExecutor).ExecuteScript(
              "return (window.jQuery != undefined) &amp;&amp; (jQuery.active == 0)"));
  </code></pre>
  
  <p>But I get </p>
  
  <blockquote>
    <p>"Failed: OpenQA.Selenium.WebDriverTimeoutException : Timed out after
    60 seconds"</p>
  </blockquote>