Beginner
Beginner

Reputation: 77

Get body innertext webbrowser in vb.net

This code does not work because 'innertext' is not a member of 'System.Windows.Forms.HtmlElementCollection'. Does anyone know what to do? Thanks.

 Do While WebBrowser1.ReadyState = WebBrowserReadyState.Complete
       Dim body As String = WebBrowser1.Document.GetElementsByTagName("body").innerText
 Loop

Upvotes: 2

Views: 4987

Answers (2)

Beginner
Beginner

Reputation: 77

I did:

WebBrowser1.Document.Body.innerText

Thanks for your help!

Upvotes: 2

har07
har07

Reputation: 89285

You can try using GetElementById (without 's') instead of GetElementsById (with 's') :

Dim body As String = WebBrowser1.Document.GetElementByTagName("body").innerText

The former method returns HtmlElement which has InnerText property.

Upvotes: 1

Related Questions