Extracting Text from HTMLViewer

I’m trying to extract text from an HTMLViewer for a Windows app. On Mac I can use the MonkeyBread plugin:

Dim socket1 As New HTTPSocket
Dim data As String = socket1.Get(myURL,300)
HTMLViewer1.LoadURL(myURL)
textField1.text = HTMLViewer1.EvaluateJavaScriptMBS(“document.body.innerText”)

but that is not available for Windows.

For Windows I tried:

HTMLViewer1.LoadURL(myURL)
TextField1.text = data
HTMLViewer1.ExecuteJavaScript(“alert(document.body.innerText),”)

and I get the first few lines of the page content in a javascript alert, but I’d like that to go into a TextField, but there doesn’t seem to be a way of capturing that info into the app. The TextField only has the raw HTML markup and I need to just get the innerText instead. Anyone done this on Windows?

I figured it out after some digging. This worked:

TextField1.text = HTMLViewer1.ExecuteJavaScriptSync(“document.body.innerText”)

1 Like