【发布时间】:2017-05-11 08:54:52
【问题描述】:
有很多类似的帖子。
How to get rendered html (processed by Javascript) in WebBrowser control? 建议使用类似
webBrowser1.Document.GetElementsByTagName("HTML")[0].OuterHtml;
Document 被视为对象,我没有选择使用GetElementsByTagName
Copy all text from webbrowser control 建议使用DocumentText
我有Document,但没有DocumentText
该帖子还建议webBrowser.Document.Body.InnerText;
我可以选择使用webBrowser.Document,但仅此而已。出于某种原因,webBrowser.Document 是一个对象,因此我无法访问这些方法。
Getting the HTML source through the WebBrowser control in C# 也建议使用DocumentStream。再说一次,我没有那个。
我在 WPF 应用程序中执行此操作,并使用来自 System.Windows.Controls 的 WebBrowser
我只想从网页中读取呈现的 HTML。
我的代码
public void Begin(WebBrowser wb)
{
this._wb = wb;
_wb.Navigated += _wb_Navigated;
_wb.Navigate("myUrl");
}
private void _wb_Navigated(object sender, System.Windows.Navigation.NavigationEventArgs e)
{
var html = _wb.Document;//this is where I need help
}
【问题讨论】:
-
_wb.DocumentText ?
-
@JuryGolubev,看看我帖子的第 6 行。我已经解释过它在智能感知中不存在一个选项:)
-
@Equalsk,实际上,这可以被标记为骗子。抱歉,我花了 2 天时间寻找并没有看到那个帖子
-
你的用户名是合适的 ;-)