Reputation: 63
I want to parse <a href=""></a>
tag of a website. I am trying to get the href attribute value present in each of such 'description' span classes.
I tried the following code
HtmlNodeCollection sp = htmlDocument.DocumentNode.SelectNodes("//span[@class='description']//a");
foreach (HtmlNode link in sp)
{
HtmlAttribute att = link.Attributes["href"];
System.Diagnostics.Debug.WriteLine(att.Value);
}
I am not able to get the href attribute value. What is my mistake ?
Upvotes: 0
Views: 218
Reputation: 96
You can use chrome developer tools (F12), it can help you easy to get correct xPath syntax (Copy XPath)
Upvotes: 2