title: Click on all the result links
body: <p>Scenario: Go to Yahoo.com search for hotmail and click on all the search pages one at a time.</p>
  
  <p>My code: It just prints the link of the result pages. Is there a way to click pages 2,3,4 while there is no page left? </p>
  
  <pre><code>public class QAJob {
  
      @Test
      public void jobSearch(){
          WebDriver driver= new FirefoxDriver();
          driver.get("https://yahoo.com");
          driver.findElement(By.id("uh-search-box")).sendKeys("hotmail");
          driver.findElement(By.id("uh-search-button")).click();
          driver.manage().window().maximize();
          driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
  
          //scroll down
          JavascriptExecutor jse = (JavascriptExecutor) driver;
          jse.executeScript("window.scrollBy(0,1000)", "");
  
          List&lt;WebElement&gt; result_pages=driver.findElements(By.xpath("//div[contains(@class,'pagination')]//a[contains(@title,'')]"));
  
          for (WebElement e: result_pages){
  
              Actions action= new Actions(driver);
  
              WebElement search_results=driver.findElement(By.xpath("//div[contains(@class,'pagination')]//a[contains(@title,'')]"));
              System.out.println(e.getAttribute("outerHTML"));    
          }
      }
  }
  </code></pre>