❔ Scrape with HtmlAgilityPack
Hi. I'm trying to get the values on line 5 and 14.
I've tried to get the span by class. However the InnerText is just an empty string.
Other spans on the site has id's which makes it a lot easier, but I can't figure out how to retrieve the value, when multiple spans has the same class.
In this case there is 11 "fields/properties" listed with the same class. And I would only need some of them.
4 Replies
If I do like this I get the prop value I need, however I would also need the line 14 field.
But there must be a better way than doing this 😄
Why u didnt use "query selecor' istead of "childNode.SelectSingleNode"
if u want get text of this elem "var desc = childNode.SelectSingleNode("./div/div/div/div/span[contains(@class, 'ux-textspans')]").InnerHtml;" I recommend use query selector and change path to "//div/span[contains(@class, 'ux-textspans')]"
Will try that. Thanks!
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.