title: Compare database results to html table - Selenium Webdriver - Java
body: <p>I am needing some help being able to take database results and verify they are displaying on the screen correctly. The table will be as big or little as the amount of data in the database.</p>
  
  <p>Here's some sample HTML for the table:</p>
  
  <pre><code>&lt;table class="table table-hover"&gt;
  &lt;thead&gt;
  &lt;tbody&gt;
  &lt;tr class="ng-scope" ng-repeat="item in PaymentHistoryCtrl.paymentHistoryArray | orderBy: 'date' track by $index "&gt;
  &lt;td class="ng-binding" ng-bind="item.date | date:'longDate'"&gt;February 12, 2016&lt;/td&gt;
  &lt;td class="ng-binding" ng-bind="item.policyNumber"&gt;BTB1716401&lt;/td&gt;
  &lt;td class="ng-binding" ng-bind="item.total | currency"&gt;$3,000.00&lt;/td&gt;
  &lt;td class="ng-binding" ng-bind="item.referenceNumber"&gt;3***8431&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr class="ng-scope" ng-repeat="item in PaymentHistoryCtrl.paymentHistoryArray | orderBy: 'date' track by $index "&gt;
  &lt;td class="ng-binding" ng-bind="item.date | date:'longDate'"&gt;February 12, 2016&lt;/td&gt;
  &lt;td class="ng-binding" ng-bind="item.policyNumber"&gt;BTB1716401&lt;/td&gt;
  &lt;td class="ng-binding" ng-bind="item.total | currency"&gt;$55.00&lt;/td&gt;
  &lt;td class="ng-binding" ng-bind="item.referenceNumber"&gt;3***8431&lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>Here's a sample visual of the table:</p>
  
  <p><a href="https://i.stack.imgur.com/pmZLn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pmZLn.png" alt="enter image description here"></a></p>
  
  <p>I have a sql query to gather the information displayed on the screen. How would I go about matching up the records with the rows/columns in the table, though? Here's the java I'm using for connecting to the db:</p>
  
  <pre><code>//Load the required JDBC Driver class
  Connection conn = null;
  Statement stmt = null;
  Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");  
  
  //Create a connection to the database
  String connection = "jdbc:sqlserver://" + dbName + ":" + dbPort;
  conn = DriverManager.getConnection(connection,dbUsername,dbPassword);
  
  //Execute SQL query
  stmt = conn.createStatement();
  String sql = "select * from Table";
  ResultSet rs = stmt.executeQuery(sql);
  </code></pre>