title: Selenium refresh
body: <p>I am working on project where everything is saved in events so it took some time for server to respond for new data. I am using Fluent wait for pages using ajax, but this one doesn't use any ajax. So I want to refresh page check if new item is there if not refresh again. How this is achieved in Selenium 2?</p>
  
  <p>I did this : </p>
  
  <pre><code>        def accountsAfterCreating = 0
          while (accountsAfterCreating &lt;= existingAccounts) {
              driver.navigate().refresh()
              WebElement table = wait.until(new Function&lt;WebDriver, WebElement&gt;() {
                  public WebElement apply(WebDriver driver) {
                      return driver.findElement(By.className("table"))
                  }
              })
              accountsAfterCreating = table.findElements(By.className("amount")).size()
          }
  </code></pre>
  
  <p>Is it correct way?</p>