//Expected:iwantthis.com Actual:home.com,
string url = contentDiv.SelectSingleNode("//tr[@class='blueRow']")
.SelectSingleNode("//a") //What should this be ?
.GetAttributeValue("href", "");
我必须用以下代码替换上面的代码:
var tds = contentDiv.SelectSingleNode("//tr[@class='blueRow']").Descendants("td");
string url = "";
foreach (HtmlNode td in tds)
{
if (td.Descendants("a").Any())
{
url= td.ChildNodes.First().GetAttributeValue("href", "");
}
}