I am trying to parse the first link in the html code below /search?id=3
<div class="brs_col">
<p>
<a href="/search?id=3">
<b>
vastu shastra
</b>
</a>
</p>
<p>
<a href="/search?id=1">
<b>
bygga
</b>
bastu
</a>
</p>
</div>
I've tried to select it with the following XPATH, but cant seem to get any of them to work:
//div[@class='brs_col']//p//a[@href]
//div[@class='brs_col']//p[0]//a[@href]
//div[@class='brs_col']//p//a[0][@href]
Any ideas?
This if you sure that is the first url in the whole HTML document:
doc.DocumentNode.SelectSingleNode("//a").Attributes["href"].Value;
Or this if you sure that is the first ulr in the class brs_col
doc.DocumentNode.SelectSingleNode("//div[@class='brs_col']//a").Attributes["href"].Value;