1

I'm trying to set value of form in DotNetBrowser, but to get this form I have to use

var b = browserView.Browser.GetDocument().GetElementsByTagName("span")[1];

because ID's of forms aren't unique. The problem is that returns me

DotNetBrowser.DOM.DOMNode

and to make a usage from example that provides DotNetBrowser link. I need

DotNetBrowser.DOM.DOMInputElement

which I have no idea how to convert into.

1
  • 2
    a span isn't an input element. Sep 12, 2017 at 23:13

1 Answer 1

1

The span DOM node can be safely casted to DOMElement:

var b = browserView1.Browser.GetDocument().GetElementsByTagName("span")[1] as DOMElement;

You can also use a DOMNode.NodeType property to check the node type and then perform a safe cast:

if (b.NodeType == DOMNodeType.ElementNode) {
    DOMElement element = b as DOMElement;
    //...
}

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.