views:

59

answers:

2

I'm using the following code to bind watin to a webbrowser on the winform.

Dim w As IE = New IE(WebBrowser1.ActiveXInstance)
Settings.AutoStartDialogWatcher = False
w.GoTo("http://google.com")

I can see from wireshark that the page get's loaded, but the form is frozen until a exception gets thrown "Timeout while Internet Explorer busy".

Is there a way to bind watin to the webbrowser control ?

A: 

If I use this code it works

ie = New IE(WebBrowser1.ActiveXInstance) ie.GoToNoWait("http://google.com") While WebBrowser1.ReadyState <> WebBrowserReadyState.Complete Application.DoEvents() End While

If it is not the best solution, but it works for me

julio
A: 

First of all, I think that this line:

Settings.AutoStartDialogWatcher = False

should be at the beginning, before IE instance is created.

Your code will work if you run it in separate thread.

Code in C# (sorry):

var thread = new Thread(() =>
{
    Settings.AutoStartDialogWatcher = false;
    var ie = new IE(webBrowser1.ActiveXInstance);
    ie.GoTo("http://www.google.com");
});
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
prostynick