1

So i want to get the visible content of a page using a web browser control, the programming language does't matter C# or VB is totally fine, i am already using something like this

Dim wb As New WebBrowser
wb.Navigate("http://some_random_website.com")

While wb.ReadyState <> WebBrowserReadyState.Complete 
            Application.DoEvents()
End While
Dim content_retrieved as string = wb.Document.Body.InnerText

(i am only interested in the visible content not the html source)

Which basically makes the program do nothing until the web browser client has finished loading the page and it works just fine

But i have some pages that creates their content dynamically and the WebBrowserReadyState.Complete fires before the javascript has done loading its functions so i get the page without the dynamically created content

Any solution or reference would be very helpful. Thank's in advance!

Stefan
  • 11
  • 3

1 Answers1

0

You can use the DocumentCompleted event in C#.

Usage shown here - https://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.documentcompleted(v=vs.110).aspx

  • I have already tried that but the DocumentCompleted event also fires before the javascript has done loading . Thank you for your response though – Stefan Feb 28 '17 at 14:30