I developing one asp.net application in that I using htmlagility dll to get all <div> tags which is same class attributes..
How to get all elements who have same class from whole html page,
I getting top 1 div who having class=’myclass’ but in,
my case I want to all div tags who have ‘myclass’ class.
var vardoc = web.Load("<any website url>");
var varmyclass = doc.DocumentNode.SelectSingleNode("//div[@class='myclass']");
when I used above method then I getting inner html content of the ‘myclass’ but in my html contents there are many div tags who have class ‘myclass’.
I want to get all <div> who have same class using HTMLagility or other
Don’t select a single node in that case.
You are using
SelectSingleNode, which will return only one node.Use
SelectNodesinstead: