How to get something like "descendant-AND-self::" to htmlNode
See the question and my original answer on StackOverflowThe FORM is treated specially by default by the Html Agility Pack. See here why: HtmlAgilityPack -- Does <form> close itself for some reason?
This code should get all the FORM elements:
HtmlDocument doc = new HtmlDocument();
HtmlNode.ElementsFlags.Remove("form");
doc.Load(myTestHtm);
foreach (var v in doc.DocumentNode.SelectNodes("//form"))
{
Console.WriteLine(v.OuterHtml);
}