Search code examples
c#dotnetbrowser

Get the outer HTML of a DotNetBrowser DOMElement


The DotNetBrowser DOMElement has an InnerHTML property but doesn't have an OuterHTML property.

Is there a way to get the html of the entire element and its children?

I thought ToString() might do it but it returns empty.


Solution

  • The IElement.OuterHtml property became a part of DotNetBrowser 2.0 API.

    Here is a documentation reference: https://dotnetbrowser-support.teamdev.com/apidoc/2.0/html/P_DotNetBrowser_Dom_IElement_OuterHtml.htm

    This property is writable, and changing its value will replace the element and its DOM sub-tree.

    While the element will be replaced in the document, the variable whose OuterHtml property was set will still hold a reference to the original element.

    In case of any further questions, feel free to contact us at customer-care@teamdev.com