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

£可爱£侵袭症+ 提交于 2019-12-02 04:35:30

问题


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?


回答1:


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

 string str = frame.Document.Body.OuterHtml;



回答2:


my best option was:

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


来源:https://stackoverflow.com/questions/1498719/how-to-retrieve-html-from-webbrowser-control-out-of-frames-in-net-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!