Reputation: 81
I'm trying to get list of elements in DOM:
private void geckoWebBrowser1_DocumentCompletedEvent(object sender, EventArgs e) {
nsIDOMHTMLDocument givenDocument = geckoWebBrowser1.Document as nsIDOMHTMLDocument;
var iframes = givenDocument.GetElementsByTagName(tagname);
var iframe = iframes.Item(0);
}
but givenDocument is always null.
I'm trying to find how to work with any of nsIDOMHTML types. Everything I've tried returned null so far.
Upvotes: 1
Views: 136
Reputation: 4786
Why do you cast to nsIDOMHTMLDocument?
You can get the .GetElementsByTagName(tagName); method from GeckoDocument as well, and this works OK without the cast.
GeckoDocument document = this.Browser.Document;
GeckoFrameElement frame = document.GetElementsByTagName("frame")[0] as GeckoFrameElement;
Upvotes: 1