开发者

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")
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜