Reputation: 103
i have an html code in my html page :
<span itemprop="title" data-andiallelmwithtext="15" aria-current="page" aria-label="you are on laptop categories">laptops</span>
in my crawler , i'm trying to see on what page i'm in it, so i have tried this:
var productLocation = dc.DocumentNode.SelectSingleNode("//span[@itemprop='title']").InnerText;
the problem is that i have more the one Node with itemprop='title'
how to reach the specific node, in order to get
productLocation = "you are on laptop categories"
Upvotes: 0
Views: 73
Reputation: 24930
Try changing your xpath expression to
//span[@itemprop='title'and @aria-label='you are on laptop categories']
or
//span[@itemprop='title'][@aria-label='you are on laptop categories']
Upvotes: 0