title: .NET Selenium NoSuchElementException; WebDriverWait.Until() doesn't work
body: <p>We have a .NET 4.5, MVC, C# project.  We're using Selenium for UI tests, and the tests keep intermittently failing on lines that we have <code>wait.Until()</code>.  One such example is:</p>
  
  <pre><code>NoSuchElementException was unhandled by user code
  An exception of type 'OpenQA.Selenium.NoSuchElementException' occurred in WebDriver.dll but was not handled in user code
  Additional information: Unable to locate element: {"method":"css selector","selector":"#assessment-472 .status-PushedToSEAS"}
  </code></pre>
  
  <p>It's thrown right here:</p>
  
  <pre><code>Thread.Sleep(600);
  wait.Until(drv =&gt; drv.FindElement(By.CssSelector("#" + assessmentQueueId + " .status-PushedToSEAS")));
  </code></pre>
  
  <p>I can see that the browser opens, I see it get to that point, and I can inspect element to see that the element exists.  Its id is exactly correct.</p>
  
  <p>We have this problem <strong>A LOT</strong> and so far the solution has been to throw <code>Thread.Sleep(600)</code> (or some similar time) in front of it.  The whole point of <code>wait.Until()</code> is to not have to do that, and this is making our test suites get very long.  Also, as you can see in the example above, sometimes we have the problem even after putting a <code>Thread.Sleep()</code> in front of it and we have to extend the time.</p>
  
  <p>Why is .NET Selenium's <code>WebDriver.Until()</code> not working, and is there a different way to do the same thing without just waiting a set period of time?  Again, the problem is intermittent, meaning that it only happens sometimes, and it could happen at any number of <code>wait.Until()</code> statements, not just the one shown!</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>This is a class variable.
  <code>private WebDriverWait wait;</code></p>
  
  <p>It is instantiated like this:</p>
  
  <pre><code>this.wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
  </code></pre>