Itay.B
Itay.B

Reputation: 4111

C# webBrowser object

I'm using the webBrowser object to surf to a page that has an Iframe. I'm trying to get the Specific objects in this iframe by using the GetElementByID function. I do something like this: webBrowser1.document.GetelementByID("iframeName").document.GetElementByID("ElementName)

It doesn't work. I get Null.

Any ideas?

TY

Upvotes: 1

Views: 319

Answers (1)

SLaks
SLaks

Reputation: 887275

The Document property gets the HtmlDocument object that owns the element, not the document in the <iframe>.

Instead, you should use the HtmlWindow.Frames collection, like this:

myWebBrowser.Document.Window.Frames["IFrameName"].Document.GetElementByID("ElementName")

Upvotes: 2

Related Questions