title: Pagination in webDriver displays Stale Element Reference Exception
body: <p>Environment : Eclipse, Chrome, Java</p>
  
  <p>I am dealing with test case for pagination in the application. I have tried with some code, but it moves only upto 2nd page.</p>
  
  <p>Code :</p>
  
  <pre><code>List&lt;WebElement&gt; allpages = driver.findElements(By.xpath("//div[@class='pagination']//a"));
      System.out.println(allpages.size());
      if(allpages.size()&gt;0)
      {
          System.out.println("Pagination exists");
          for(int i=0; i&lt;allpages.size(); i++)
          {
              Thread.sleep(3000);
              allpages.get(i).click();
              driver.manage().timeouts().pageLoadTimeout(5, TimeUnit.SECONDS);
              //System.out.println(i);
          }
      }
      else
      {
          System.out.println("Pagination doesn't exists");
      }
  }
  </code></pre>
  
  <p>Size displayed is 12. The issue is it moves upto 2nd page only and then displays error of StaleElementReference</p>
  
  <p>Here's the HTML Code for the same pagination. 
  HTML Code :</p>
  
  <pre><code>&lt;div id="page-navigation" class="pull-right"&gt;
  &lt;div id="303b171e-5a26-e456" class="flex-view"&gt;
  &lt;div class="pagination"&gt;
  &lt;ul&gt;
  &lt;li class=""&gt;
  &lt;a href="#" data-value="0"&gt;«&lt;/a&gt;
  &lt;/li&gt;
  &lt;li class="" data-value="0"&gt;
  &lt;a href="#" data-value="0"&gt;1&lt;/a&gt;
  &lt;/li&gt;
  &lt;li class="" data-value="1"&gt;
  &lt;a href="#" data-value="1"&gt;2&lt;/a&gt;
  &lt;/li&gt;
  &lt;li class="active" data-value="2"&gt;
  &lt;a href="#" data-value="2"&gt;3&lt;/a&gt;
  &lt;/li&gt;
  .....
  </code></pre>