title: Selenium webdriver iterate through rows and retrieve only certain columns
body: <p>I have a <code>tbody</code> with multiple <code>tr</code>s and 10 <code>td</code>s per <code>tr</code>.</p>
  
  <p>I want to iterate through the <code>tr</code>s and get the <code>.text()</code> of only specific <code>td</code>s.
  Below is the section where I itterate throught the <code>tr</code>s which have been assigned to a <code>List</code> (<code>alertsTableRowsList</code>)</p>
  
  <pre><code>for (int i = 0; i &lt; alertsTableRowsCount; i++){     
  
              String reference = alertsTableRowsList.get(i).findElement(By.xpath("//td[@data-title-text = 'Reference']")).getText(); //td number 3
              String classification = alertsTableRowsList.get(i).findElement(By.xpath("//td[@data-title-text = 'Classification']")).getText(); //td number 4
              String description = alertsTableRowsList.get(i).findElement(By.xpath("//td[@data-title-text = 'Description']")).getText(); //td number 7
              String status = alertsTableRowsList.get(i).findElement(By.xpath("//td[@data-title-text = 'Status']")).getText(); //td number 8
              String date = alertsTableRowsList.get(i).findElement(By.xpath("//td[@data-title-text = 'Date']")).getText(); //td number 9
              String owner = alertsTableRowsList.get(i).findElement(By.xpath("//td[@data-title-text = 'Owner']")).getText(); //td number 10
  
              System.out.println("reference : " + reference);
              System.out.println("classification : " + classification);
              System.out.println("description : " + description);
              System.out.println("status : " + status);
              System.out.println("date : " + date);
              System.out.println("owner : " + owner); 
  
          }
  </code></pre>
  
  <p>What I notice is that only the <code>.text()</code> of the <code>td</code>s in the first <code>tr</code> is returned. In this case it is returned twice because in this case I have only two <code>tr</code>s in my <code>tbody</code>.</p>
  
  <p>Output:</p>
  
  <pre><code>reference : AML_AC.20161102.12
  classification : AML Central Alert
  Wholesale - Wire transfer
  description : Thoughtbeat Ltd
  status : Analysis
  date : 11/02/2016
  owner : Strydom, AJ (Rico)
  
  reference : AML_AC.20161102.12
  classification : AML Central Alert
  Wholesale - Wire transfer
  description : Thoughtbeat Ltd
  status : Analysis
  date : 11/02/2016
  owner : Strydom, AJ (Rico)
  </code></pre>
  
  <p>HTML for the tbody:</p>
  
  <pre><code>&lt;tbody&gt;
     &lt;!-- ngRepeat: searchResult in $data --&gt;
     &lt;tr ng-repeat="searchResult in $data" ng-click="vm.clickEntity(searchResult)" ng-dblclick="vm.dblClickEntity()" ng-class="{ 'is-selected': vm.isEntitySelected(searchResult.id) }" class="pointer ng-scope" title="Thoughtbeat Ltd"&gt;
        &lt;!-- ngIf: core.user.can('webhq.home.assign') --&gt;
        &lt;td data-title="''" class="table-icon-cell ng-scope" ng-if="core.user.can('webhq.home.assign')" ng-click="$event.stopPropagation()" header="vm.checkboxTemplate" data-title-text=""&gt;
           &lt;!-- ngIf: vm.isEditable(searchResult) --&gt;
           &lt;div class="checkbox ng-scope" ng-if="vm.isEditable(searchResult)"&gt;&lt;label&gt;&lt;input type="checkbox" ng-model="vm.checkedEntities[searchResult.id]" ng-change="vm.entityChecked()" class="ng-pristine ng-untouched ng-valid ng-empty"&gt; &lt;span class="checkbox-label"&gt;&lt;/span&gt;&lt;/label&gt;&lt;/div&gt;
           &lt;!-- end ngIf: vm.isEditable(searchResult) --&gt;
        &lt;/td&gt;
        &lt;!-- end ngIf: core.user.can('webhq.home.assign') --&gt;
        &lt;td data-title="'*'" sortable="'attentionIcon'" class="table-icon-cell" data-title-text="*"&gt;&lt;img bf-image-path="" class="table-icon" src="/Assets/img/icons/_blank.png"&gt;&lt;/td&gt;
        &lt;td data-title="'HOME.REFERENCE' | translate" sortable="'reference'" data-title-text="Reference" class="ng-binding"&gt;AML_AC.20161102.12&lt;/td&gt;
        &lt;td data-title="'HOME.CLASSIFICATION' | translate" sortable="'classification.id'" data-title-text="Classification" class="ng-binding"&gt;
           &lt;img bf-image-path="writtentransfer" class="table-icon" src="/Assets/img/icons/writtentransfer.png"&gt; AML Central Alert &lt;!-- ngIf: ::searchResult.variation.displayName --&gt;&lt;small class="text-muted ng-binding ng-scope" ng-if="::searchResult.variation.displayName"&gt;&lt;br&gt;&lt;img bf-image-path="'_blank'" class="table-icon" src="/Assets/img/icons/_blank.png"&gt; Wholesale - Wire transfer&lt;/small&gt;&lt;!-- end ngIf: ::searchResult.variation.displayName --&gt;
        &lt;/td&gt;
        &lt;td data-title="'*'" sortable="'attachmentCount'" class="table-icon-cell" data-title-text="*"&gt;&lt;img bf-image-path="_blank" class="table-icon" title="0 files attached" src="/Assets/img/icons/_blank.png"&gt;&lt;/td&gt;
        &lt;td data-title="'*'" sortable="'notesCount'" class="table-icon-cell" data-title-text="*"&gt;&lt;img bf-image-path="_blank" class="table-icon" title="0 notes" src="/Assets/img/icons/_blank.png"&gt;&lt;/td&gt;
        &lt;td data-title="'HOME.NAME' | translate" sortable="'displayName'" data-title-text="Description"&gt;&lt;img bf-image-path="priority_normal" class="table-icon" src="/Assets/img/icons/priority_normal.png"&gt; &lt;strong class="ng-binding"&gt;Thoughtbeat Ltd&lt;/strong&gt;&lt;/td&gt;
        &lt;td data-title="'HOME.STATUS' | translate" sortable="'status.progress'" data-title-text="Status"&gt;&lt;img bf-image-path="microscope" class="table-icon" src="/Assets/img/icons/microscope.png"&gt; &lt;span ng-class="{ 'text-danger': searchResult.status.attract }" class="ng-binding"&gt;Analysis&lt;/span&gt;&lt;/td&gt;
        &lt;td data-title="'HOME.DATE' | translate" sortable="'startDate'" data-title-text="Date"&gt;&lt;span ng-hide="searchResult.isDue" class="ng-binding"&gt;11/02/2016&lt;/span&gt; &lt;span ng-show="searchResult.isDue" class="text-danger ng-hide"&gt;&lt;strong class="ng-binding"&gt;due in 2 days&lt;/strong&gt;&lt;/span&gt;&lt;/td&gt;
        &lt;td data-title="'HOME.OWNER' | translate" sortable="'ownerName'" data-title-text="Owner" class="ng-binding"&gt;
           Strydom, AJ (Rico) &lt;!-- ngIf: ::searchResult.teamName --&gt;&lt;small ng-if="::searchResult.teamName" class="text-muted ng-binding ng-scope"&gt;&lt;br&gt;TEST role&lt;/small&gt;&lt;!-- end ngIf: ::searchResult.teamName --&gt;
        &lt;/td&gt;
     &lt;/tr&gt;
     &lt;!-- end ngRepeat: searchResult in $data --&gt;
     &lt;tr ng-repeat="searchResult in $data" ng-click="vm.clickEntity(searchResult)" ng-dblclick="vm.dblClickEntity()" ng-class="{ 'is-selected': vm.isEntitySelected(searchResult.id) }" class="pointer ng-scope" title="Skiba Ltd"&gt;
        &lt;!-- ngIf: core.user.can('webhq.home.assign') --&gt;
        &lt;td data-title="''" class="table-icon-cell ng-scope" ng-if="core.user.can('webhq.home.assign')" ng-click="$event.stopPropagation()" header="vm.checkboxTemplate" data-title-text=""&gt;
           &lt;!-- ngIf: vm.isEditable(searchResult) --&gt;
           &lt;div class="checkbox ng-scope" ng-if="vm.isEditable(searchResult)"&gt;&lt;label&gt;&lt;input type="checkbox" ng-model="vm.checkedEntities[searchResult.id]" ng-change="vm.entityChecked()" class="ng-pristine ng-untouched ng-valid ng-empty"&gt; &lt;span class="checkbox-label"&gt;&lt;/span&gt;&lt;/label&gt;&lt;/div&gt;
           &lt;!-- end ngIf: vm.isEditable(searchResult) --&gt;
        &lt;/td&gt;
        &lt;!-- end ngIf: core.user.can('webhq.home.assign') --&gt;
        &lt;td data-title="'*'" sortable="'attentionIcon'" class="table-icon-cell" data-title-text="*"&gt;&lt;img bf-image-path="" class="table-icon" src="/Assets/img/icons/_blank.png"&gt;&lt;/td&gt;
        &lt;td data-title="'HOME.REFERENCE' | translate" sortable="'reference'" data-title-text="Reference" class="ng-binding"&gt;AML_AC.20161102.9&lt;/td&gt;
        &lt;td data-title="'HOME.CLASSIFICATION' | translate" sortable="'classification.id'" data-title-text="Classification" class="ng-binding"&gt;
           &lt;img bf-image-path="writtentransfer" class="table-icon" src="/Assets/img/icons/writtentransfer.png"&gt; AML Central Alert &lt;!-- ngIf: ::searchResult.variation.displayName --&gt;&lt;small class="text-muted ng-binding ng-scope" ng-if="::searchResult.variation.displayName"&gt;&lt;br&gt;&lt;img bf-image-path="'_blank'" class="table-icon" src="/Assets/img/icons/_blank.png"&gt; Private Banking - Wire Transfer&lt;/small&gt;&lt;!-- end ngIf: ::searchResult.variation.displayName --&gt;
        &lt;/td&gt;
        &lt;td data-title="'*'" sortable="'attachmentCount'" class="table-icon-cell" data-title-text="*"&gt;&lt;img bf-image-path="_blank" class="table-icon" title="0 files attached" src="/Assets/img/icons/_blank.png"&gt;&lt;/td&gt;
        &lt;td data-title="'*'" sortable="'notesCount'" class="table-icon-cell" data-title-text="*"&gt;&lt;img bf-image-path="_blank" class="table-icon" title="0 notes" src="/Assets/img/icons/_blank.png"&gt;&lt;/td&gt;
        &lt;td data-title="'HOME.NAME' | translate" sortable="'displayName'" data-title-text="Description"&gt;&lt;img bf-image-path="priority_normal" class="table-icon" src="/Assets/img/icons/priority_normal.png"&gt; &lt;strong class="ng-binding"&gt;Skiba Ltd&lt;/strong&gt;&lt;/td&gt;
        &lt;td data-title="'HOME.STATUS' | translate" sortable="'status.progress'" data-title-text="Status"&gt;&lt;img bf-image-path="microscope" class="table-icon" src="/Assets/img/icons/microscope.png"&gt; &lt;span ng-class="{ 'text-danger': searchResult.status.attract }" class="ng-binding"&gt;Analysis&lt;/span&gt;&lt;/td&gt;
        &lt;td data-title="'HOME.DATE' | translate" sortable="'startDate'" data-title-text="Date"&gt;&lt;span ng-hide="searchResult.isDue" class="ng-binding"&gt;11/02/2016&lt;/span&gt; &lt;span ng-show="searchResult.isDue" class="text-danger ng-hide"&gt;&lt;strong class="ng-binding"&gt;due in 3 days&lt;/strong&gt;&lt;/span&gt;&lt;/td&gt;
        &lt;td data-title="'HOME.OWNER' | translate" sortable="'ownerName'" data-title-text="Owner" class="ng-binding"&gt;
           Strydom, AJ (Rico) &lt;!-- ngIf: ::searchResult.teamName --&gt;&lt;small ng-if="::searchResult.teamName" class="text-muted ng-binding ng-scope"&gt;&lt;br&gt;TEST role&lt;/small&gt;&lt;!-- end ngIf: ::searchResult.teamName --&gt;
        &lt;/td&gt;
     &lt;/tr&gt;
     &lt;!-- end ngRepeat: searchResult in $data --&gt;
  &lt;/tbody&gt;
  </code></pre>