The code from the site looks like this:
<div class="store-rank" data-role="shop-rank"> <span class="rank-num">2475</span> <a rel="nofollow" title="Feedback Score 2475" target="_blank" href="//www.aliexpress.com/store/feedback-score/221743.html"> <img src="//ae01.alicdn.com/wimg/feedback/icon/23-s.gif" title="This is the Feedback Symbol for Feedback Scores from 2000-4999."> </a> </div> C # code:
string result = ""; HtmlWeb web = new HtmlWeb(); HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument(); doc = web.Load(URL); HtmlNode node = doc.DocumentNode.SelectSingleNode("//*[@id='j-store-header']/div/div/div[1]"); result += node.OuterHtml; The result of executing this line of code:
<div class="store-rank" data-role="shop-rank"></div> Why doesn't HtmlWeb pull the whole page? When you change XPath to"//*[@id='j-store-header']/div/div/div[1]/span" returns NULL. In this case, here is a field: //*[@id='j-product-desc']/div[1]/div[2]/ul/li from the same page is obtained without any problems.
HtmlWebpull the entire page or not, put aHtmlNode node = doc.DocumentNode.SelectSingleNodeon the lineHtmlNode node = doc.DocumentNode.SelectSingleNodeand look at the contents ofdoc. - BulsonHtmlAgilityPackand chose this one. - Bulson