You can use the following XPath:
var htmlDoc = new HtmlDocument();
htmlDoc.LoadHtml(html);
var tdOfInterests =
htmlDoc.DocumentNode
.SelectNodes("//tr[td/h3[.='My Address']]/following-sibling::tr[position() <= 2]/td");
foreach (HtmlNode td in tdOfInterests)
{
Console.WriteLine(td.InnerText);
}
The key above XPath uses following-siblingwith a filter position().
UPDATE:
A bit of XPath explanation used in this answer:
//tr[td/h3[.='My Address']]
above select an item <tr>that has:
- a child
<td>that has a child <h3>with a value of 'My Address'
/following-sibling::tr[position() <= 2]
<tr> <= 2 <tr> (, XPath)
/td
<td> <tr>