How to get HTML from Webbrowser control from Frames in .net (C #)

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

HtmlDocument htmldoc = webBrowser1.Document

But this only gives the html code of the "parent page". If the web page uses frames, it does not return html for the entire page, including frames.

How can I get the complete HTML including frames, or select one frame and get the html of that frame?

+2


source to share


2 answers


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

 string str = frame.Document.Body.OuterHtml;

      



+5


source


my best option:



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

      

+1


source







All Articles