user181901
user181901

Reputation:

How to retrieve HTML from Webbrowser control out of frames in .net (c#)

I know that I can get the HTML (source code) of a Webbrowser control via:

HtmlDocument htmldoc = webBrowser1.Document

But this does only provide the html code of the "parent page". In case the webpage uses frames, it does not return the html code for the whole page including frames.

How can I get the complete HTML code including frames - or select a single frame and get the html code of that frame?

Upvotes: 2

Views: 15737

Answers (2)

devplayer
devplayer

Reputation: 666

my best option was:

WB1.Document.Window.Frames[0].Document.GetElementsByTagName("HTML")[0].OuterHtml

Upvotes: 1

ggg
ggg

Reputation: 51

 HtmlWindow frame = webBrowser1.Document.Window.Frames[0];

 string str = frame.Document.Body.OuterHtml;

Upvotes: 5

Related Questions