I have the following table:
<table id="history-table" width="100%" cellpadding="0" cellspacing="0" border="0" class="listTable">
<thead style="font-weight: bold; background-color: #eee;">
<tr>
<td style="padding-left: 10px; padding-right: 10px;">Date
</td>
<td style="padding-left: 10px; padding-right: 10px;">Description
</td>
<td style="padding-left: 10px; padding-right: 10px; text-align: right;">Amount
</td>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
I want to select all cells in the tbody element using HtmlAgilityPack, but so far I am not able to do it.
Here is what I tried:
var table = doc.DocumentNode.SelectNodes("//*[@id='history-table']/tbody/tr"); - returns null
var table = doc.DocumentNode.SelectNodes("//*[@id='history-table']//tr"); - returns only the thead rows
var billNumbers = doc.DocumentNode
.Descendants("table")
.Where(table => table.Attributes.Contains("id"))
.SingleOrDefault(table => table.Attributes["id"].Value == "history-table"); - then trying couple of ways to foreach the result, still no success
When I copy the XPath from Chrome and paste it in the SelectNodes it returns null. Any ideas will be greatly appreciated