I just started looking into XPath but am a little confused on the following.
I'm parsing HTML (using the HTML-Agility-Pack in C# / .NET) and I'm able to call the contains function on the "class" attribute for an HTML element to only select the nodes whose class contains a specific value.
For example, the top answer on this SO: How can I match on an attribute that contains a certain string?
But I'm unable to call the contains function on the "href" attribute of the HTML "a" (hyperlink) element.
For example, it seems like a more complicate solution is needed, as per this SO accepted answer: Xpath get a if href contains part of string
And if I try to use the following XPath code, I get the ArgumentNullException: "Value cannot be null" exception.
//td/a[contains(@href, 'part-of-the-hyperlink')]
This is the relevant part of HTML I'm trying to select:
<td>
<a href="/name/part-of-the-hyperlink">
Hugh Dane
</a>
</td>
What am I missing?