title: Working with Pagination (Selenium webdriver C#)
body: <p>I am facing a problem while automating my test for Pagination.
  My code is able to iterate through table on first page and also able to click the Next page if 'Search Element not Found'. But, the problem is that for the second page it is not holding/getting the data of table. Although Class of table used is static for all pages.
  Please Help me through this. Here's my chunk of code:</p>
  
  <pre><code>IWebElement pagingInfo = webDriver.FindElement(By.ClassName("Dj")); //Getting text from Page info in the form of  "1-emailsPerPage of totalNumberOfEmails"
  string[] stringArray = pagingInfo.Text.Split(' ');
  int totalNumberOfEmails = Convert.ToInt32(stringArray[2]);
  int emailsPerPage = Convert.ToInt32(stringArray[0].Substring(2));
  int clickCount = totalNumberOfEmails / emailsPerPage;
  
  for (int i = 0; i &lt;= clickCount; i++)
  {
      IWebElement tableInbox = webDriver.FindElement(By.ClassName("Cp")).FindElement(By.ClassName("F"));
      IList&lt;IWebElement&gt; rowsCollection = tableInbox.FindElements(By.TagName("tr"));
  
      foreach (IWebElement row in rowsCollection)
      {
          IList&lt;IWebElement&gt; columnCollection = row.FindElements(By.TagName("td"));
          if (columnCollection[5].Text.Contains("Fwd: Security"))
          {
              Console.WriteLine("Record found");
              recordFound = true;
              break;
          }
      }
      if (recordFound == true)
          break;
      webDriver.FindElement(By.ClassName("ar5")).FindElement(By.ClassName("amJ")).Click();
      Thread.Sleep(5000);
  }
  
  if (recordFound == true)
      Console.WriteLine("Record Found");
  else
      Console.WriteLine("Record Not Found");
  </code></pre>
  
  <p>Please Help!! Thanks in advance :)</p>