I am using TeamDev Dotnetbrowser, for a tests, so how can I remove entire div, without a id, just using classname, for example:
<div class="home modulo-testbar"><a href="http://somelink" id="who" title="hohoho">test</a></p></div>
I hope someone could help me, please!
Regards.
Learning documentation, I found a way to "hide", but I still like remove entire div content.
I have created and used this code:
DOMDocument document = e.Browser.GetDocument();
List<DOMNode> divs = document.GetElementsByTagName("div");
foreach (DOMNode node in divs)
{
DOMElement element = node as DOMElement;
if (element.GetAttribute("class").ToLower().Contains("home modulo-testbar"))
{
element.SetAttribute("style","display:none");
}
}
From looking at DOMNode API docs, this seems like it should remove a node from its parent:
var parent = node.Parent;
if(parent != null) {
parent.removeChild(node);
}
Put the above code where you currently set the style attribute to hide the element.