VB.Net 从 WebBrowser 复制所有文本
VB.Net Copy all text from WebBrowser
我想从 WebBrowser 复制所有 可见的 文本。
Clipboard.SetText(WebBrowser1.Document.Body.InnerText)
此代码有效,但它也在 <div style="display:none">
和 </div>
之间获取文本,这是我不想要的(我只想要手动访问该网站时可见的文本) .
这对我有效 google.com。这主要是对上面评论中提到的同一问题的 c# 版本的翻译。
Dim text As String
WebBrowser1.Document.ExecCommand("SelectAll", False, Nothing)
WebBrowser1.Document.ExecCommand("Copy", False, Nothing)
text = Clipboard.GetText()
MessageBox.Show(text, "Text")
我想从 WebBrowser 复制所有 可见的 文本。
Clipboard.SetText(WebBrowser1.Document.Body.InnerText)
此代码有效,但它也在 <div style="display:none">
和 </div>
之间获取文本,这是我不想要的(我只想要手动访问该网站时可见的文本) .
这对我有效 google.com。这主要是对上面评论中提到的同一问题的 c# 版本的翻译。
Dim text As String
WebBrowser1.Document.ExecCommand("SelectAll", False, Nothing)
WebBrowser1.Document.ExecCommand("Copy", False, Nothing)
text = Clipboard.GetText()
MessageBox.Show(text, "Text")