如何从webbrowser.document获取整个html [英] How to get the whole html from webbrowser.document
本文介绍了如何从webbrowser.document获取整个html的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
dw1.body.outerhtml
来获得body的outerhtml。
如果我想获得整个文档的html,那么怎么样?
解决方案
如果您有权访问webbrowser控件,可以使用 DocumentText
属性:
Private Sub WebBrowser1_DocumentCompleted(sender As Object,e As WebBrowserDocumentCompletedEventArgs)处理WebBrowser1.DocumentCompleted
MessageBox.Show(WebBrowser1.DocumentText)
End Sub
If dw1() return webbrowser.document I know I can do:
dw1.body.outerhtml
to get the outerhtml of the body. That's it, body, header, etc.
What about if I want to get the html of the whole document?
解决方案
If you have access to the webbrowser control, you can use the DocumentText
property:
Private Sub WebBrowser1_DocumentCompleted(sender As Object, e As WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
MessageBox.Show(WebBrowser1.DocumentText)
End Sub
这篇关于如何从webbrowser.document获取整个html的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文