2016-08-03 57 views
0

的innerText我有這樣的結構:如何獲得鏈接或使用HTMLAgilityPack

<p class="info">Sample: 
    <strong> 
     <a href="http://PleaseGetMe.com"target="_blank">http://PleaseGetMe.com</a> 
    </strong> 
</p> 

我想是讓http://PleaseGetMe.com

這裏是我嘗試:

   var a = doc.SelectNodes("//*[@class='info']//a"); 
       Console.WriteLine(a); 

哪個不成功。

回答

0

這是我實現

foreach (HtmlNode node in doc.SelectNodes("//*[@class='info']//a")) 
       { 
        string value = node.InnerText; 
        Console.WriteLine(value); 
       }