Reputation: 13
Requirement : Get the value 4.030 by locating the node containing 'Last'
<tbody><tr>
<td rowspan="2" class="bg1 W1">
<ul class="UL1">
<li class="LI1 font12_grey W1">Last</li>
</ul>
<ul class="UL1">
<li class="LI2 font28 C bold W1"><span class="pos bold">4.030</span></li>
</ul>
nameNodes = doc.DocumentNode.SelectNodes("//td[text()='Last']/ul/li/span");
foreach (HtmlNode x in nameNodes)
Debug.WriteLine(x.InnerText);
I tried many other ways but still not able to get the 4.030
Appreciate if anyone can help
Upvotes: 1
Views: 1226
Reputation: 263
try this.
nameNodes = doc.DocumentNode.SelectNodes("//*[@class='UL1']/li/span");
foreach (HtmlNode x in nameNodes)
Debug.WriteLine(x.InnerText);
not tested but give it a try!
Upvotes: 1