已通过网络浏览器下载页面,需要获取邮件地址。但它是由javastript生成的。在代码中我可以找到这个脚本:
<script type="text/javascript" charset="utf-8">var i='ma'+'il'+'to';var a='impexta@impexta.sk';document.write('<a href="'+i+':'+a+'" onclick="_kt.i(386728, 20);">'+a+'</a>');</script>
我到处阅读如何调用脚本,我不知道他的名字。所以我想要的是获得“a”变量值。
编辑:之前的代码:
...
WebBrowser wb = new WebBrowser();
wb.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(wb_DocumentCompleted);
wb.Navigate(url);
for (; wb.ReadyState != WebBrowserReadyState.Complete; )
{
System.Windows.Forms.Application.DoEvents();
}
...
void wb_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
WebBrowser wb = sender as WebBrowser;
if (wb != null)
{
if (wb.ReadyState == WebBrowserReadyState.Complete)
{
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
doc.Load(wb.DocumentStream);
}
}
}