title: Is it worth to use Selenium com.thoughtworks.selenium.Wait class for waiting? (Performance)
body: <p>Selenium has class <a href="http://grepcode.com/file/repo1.maven.org/maven2/org.testatoo.openqa/selenium-java-client-driver/1.0.2_20090715/com/thoughtworks/selenium/Wait.java" rel="nofollow">com.thoughtworks.selenium.Wait</a> for convinience. I use it in next way: </p>
  
  <pre><code>public void waitForElement(final String locator){
      Wait a = new Wait(){
          @Override public boolean until(){
               selenium.isElementPresent(locator);
          }
      }
  
      a.wait("Cannot found locator " + locator, TIMEOUT);
  }
  </code></pre>
  
  <p>As I understand each time when I call my function new anonymous class will be created and then created object of this class. Or only one anonymous class will be created?</p>
  
  <p>Anyway. How faster is just using <code>Thread.sleep()</code> directly inside <code>waitForElement</code> method then creating new object each time? How big can be this difference?</p>