Quantcast
Channel: htmlagilitypack Forum Rss Feed
Viewing all articles
Browse latest Browse all 655

New Post: Gettig Htmlelement based on HtmlAgilityPack.HtmlNode

$
0
0

I am able to find Html Node using following code in HtmlAgility Document.

But after getting the HtmlNode, I want to retun the corresponding System.Windows.Forms.Htmlelement(Webbrowser).

Please help me if any one has done this before.

 
HtmlAgilityPack.HtmlDocument htmlAgility = new HtmlAgilityPack.HtmlDocument();
htmlAgility.LoadHtml(WebBrowser.DocumentText);
string xPath= "/html[1]/body[1]/table[1]/tr[1]/td[1]/table[1]/tr[1]/td[1]/div[1]/table[1]/tr[3]/td[3]/input[1]";
HtmlAgilityPack.HtmlNode retrunElement;


IEnumerable<HtmlAgilityPack.HtmlNode> HAPnodes = Enumerable.Empty<HtmlAgilityPack.HtmlNode>();
                HtmlAgilityPack.HtmlNode node = htmlAgility.DocumentNode;
                HAPnodes = node.SelectNodes(xPath);

if (HAPnodes.Count() == 1)
                {
                    retrunElement = HAPnodes.ElementAt(0);
}









Viewing all articles
Browse latest Browse all 655

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>