Search code examples
c#winformswatin

WatiN - working with WatIn in winForm


I start working with WatiN and I want to know, can I see the results without opening WatIn opening the browser automatically?

I mean, when I do:

using (var browser = new IE("http://www.google.com"))
{
    browser.TextField(Find.ByName("q")).Value = "GOGOOG";
}

it works great (and really fast), but I would like to see this inside a win Form without opening the browser.

So my real question is:

Can I use WatiN with the WebBrowser object/Control in winForm?


Solution

  • Look at this post:

    WatiN with webbrowser

    There the ActiveX Instance is used to create an IE instance:

    Settings.AutoStartDialogWatcher = false;
    var ie = new IE(webBrowser1.ActiveXInstance);
    ie.GoTo("http://www.google.com");