title: How can i get all the links of a webpage and click one by one using selenium
body: <p>How can i get all the links of a webpage and click one by one using selenium</p>
  
  <p>//Code</p>
  
  <pre><code>  WebDriver driver = new FirefoxDriver();
      driver.get("http://www.HRS.com");
      List&lt;WebElement&gt; MyList = driver.findElements(By.xpath("//a")); 
      for(WebElement Element : MyList)
      {
      Element.click();  ----&gt; m getting an error (IN 2 ITERATION) stating 
                             "Element not found in the cache - perhaps the page has 
                              changed since it was looked up" 
  
      }
  </code></pre>
  
  <p>Can any one help me out ?</p>
  
  <p>Thanks in advance </p>