title: In Selenium Webdriver, ExpectedCondition.elementToBeClickable is not waiting until the progress bar disappears
body: <p>This question is similar to the one below:<br/>
  i.e. How to wait till Progress bar disappears.<br/>
  <a href="https://stackoverflow.com/questions/20901014/how-to-wait-dynamically-until-the-progress-bar-to-load-completely-in-selenium-we">How to wait dynamically until the progress bar to load completely in Selenium Webdriver?</a></p>
  
  <p>My situation is a bit different. In my scenario, all the elements are disabled when the progress bar appears. I am using explicit wait but still getting the exception.<br/><br/>
  <b>Scenario:</b>
  After providing all the details in the Signup Page the script clicks on the "Create Account" button. At this point a circular progress bar appears and it persists for 1 or 2 seconds. If the password entered is invalid  the error message is displayed at the top of the Signup page. I now need to click on the "Cancel" button and repeat the process.<br/><br/>
  When the progress bar appears the whole page is disabled. The user will be able to continue only after the disappearance of the progress bar.<br/><br/>
  Here's my code:<br/><br/>
      WebDriverWait myWaitVar = new WebDriverWait(driver,20);</p>
  
  <p>After clicking on the "Create Account" button the progress bar is displayed. The code should now wait until the "Cancel" button appears.</p>
  
  <pre><code>//Click on the "Create Account" button.
  driver.findElement(By.id("createAccount")).click();
  
  //Wait till the "Cancel" button shows up -- this may take some time.
  myWaitVar.until(ExpectedConditions.elementToBeClickable (By.id("cancelRegister")));
  
  //Click on the "Cancel" button.
  driver.findElement(By.id("cancelRegister")).click();
  </code></pre>
  
  <p>When I execute the above code I always get <code>NoSuchElementException</code> at the last line.<br/><br/>
  I tried with <code>ExpectedCondition.visibilityOfElement()</code> but this also produces <code>NoSuchElementException</code>.</p>
  
  <p>The only way I can get it to work is by forcing it to sleep:</p>
  
  <pre><code>Thread.sleep(3000);
  </code></pre>
  
  <p>The script works fine with the sleep.<br/><br/></p>
  
  <p>Why doesn't <code>WebDriverWait</code> wait until the progress bar disappears? The code successfully parses the <code>elementToBeClickable()</code> but it always throws an exception when the "Cancel" button is clicked.<br/></p>