In some cases (e.g. automation testing) you might need to block current thread execution and wait until web page is loaded completely.

You can use the FinishLoadingFrameEvent to be informed when the main frame is loaded. At this point, you can assume that the page is loaded completely and execute JavaScript, work with DOM, etc.

The following sample code demonstrates how to load web page and wait until it's loaded completely:

ManualResetEvent waitEvent = new ManualResetEvent(false);
browser.FinishLoadingFrameEvent += delegate(object sender, FinishLoadingEventArgs e)
    // Wait until main document of the web page is loaded completely.
    if (e.IsMainFrame)

Dim waitEvent As New ManualResetEvent(False)
AddHandler browser.FinishLoadingFrameEvent, Sub(sender, e)
                               If (e.IsMainFrame) Then
                               End If
                             End Sub