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("ifr开发者_StackOverflow社区ameName").document.GetElementByID("ElementName)
It doesn't work. I get Null.
Any ideas?
TY
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")
精彩评论