VB.Net Copy all text from WebBrowser

html html-agility-pack vb.net webbrowser-control

Question

I want to copy the whole WebBrowser content starting with zzz-5.

Clipboard.SetText(WebBrowser1.Document.Body.InnerText)

This code works, however it also receives text in between<div style="display:none"> and </div> things I do not want (i want only text that is visible when I manually go to that website).

1
0
2/5/2017 5:50:44 PM

Accepted Answer

For me, this works against google.com. The majority of this is a translation of the same question's c# counterpart, which was referenced in the comments above.

    Dim text As String
    WebBrowser1.Document.ExecCommand("SelectAll", False, Nothing)
    WebBrowser1.Document.ExecCommand("Copy", False, Nothing)
    text = Clipboard.GetText()
    MessageBox.Show(text, "Text")
0
2/6/2017 4:30:03 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow