How to retrieve HTML from Webbrowser control out o

2020-04-14 12:29发布

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?

2条回答
淡お忘
2楼-- · 2020-04-14 12:38
 HtmlWindow frame = webBrowser1.Document.Window.Frames[0];

 string str = frame.Document.Body.OuterHtml;
查看更多
Deceive 欺骗
3楼-- · 2020-04-14 12:49

my best option was:

WB1.Document.Window.Frames[0].Document.GetElementsByTagName("HTML")[0].OuterHtml
查看更多
登录 后发表回答