HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument(); doc.LoadHtml(html); var Divs = doc.DocumentNode.SelectNodes("//div[(contains(@style,'display:none'))]"); if (noneDivs != null) { foreach (var one in noneDivs.ToList()) { one.Remove(); } }