title: Click loop until the (button) element found for multiple buttons in java
body: <p>I want to click the 'Followed' button until it found in the web page.</p>
  
  <p>I've below code:</p>
  
  <pre><code>@Test
  public void testCar() throws Exception 
  {
      driver.get("https://-----/login/");
      driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
      driver.findElement(By.id("username")).clear();
      driver.findElement(By.id("username")).sendKeys("user");
      driver.findElement(By.id("password")).clear();
      driver.findElement(By.id("password")).sendKeys("password");
      driver.findElement(By.xpath("//button[@type='submit']")).click();
      driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
      driver.findElement(By.xpath("//span[text()='Followed']")).click();
  }
  </code></pre>
  
  <p>How can I do this? if not found the element then click next page &amp; find the button again.</p>
  
  <p>here is the next button HTML:</p>
  
  <pre><code>&lt;span&gt;Next Page&lt;/span&gt;
  </code></pre>
  
  <p>Please help.</p>