2

我知道我可以通过以下方式获取 Webbrowser 控件的 HTML(源代码):

HtmlDocument htmldoc = webBrowser1.Document

但这确实只提供了“父页面”的html代码。如果网页使用框架,它不会返回包括框架在内的整个页面的 html 代码。

如何获取包含框架的完整 HTML 代码 - 或选择单个框架并获取该框架的 html 代码?

4

2 回答 2

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

 string str = frame.Document.Body.OuterHtml;
于 2009-10-15T10:45:33.890 回答
1

my best option was:

WB1.Document.Window.Frames[0].Document.GetElementsByTagName("HTML")[0].OuterHtml
于 2011-12-06T00:16:24.113 回答