This will be a helper class when testing Web applications with different WatiN Features and StepDefinition classes.
You can get the browser object from anytime from this class and it will be useful when testing with lot of features and step definitions.
Category: WatiN
Getting Started with WatiN
Here’s a code snippet to start testing with WatiN. Got it from the WatiN web site.
using System;
using WatiN.Core;
namespaceWatiNGettingStarted
{
class WatiNConsoleExample
{
[STAThread]
static void Main(string[] args)
{
// Open a new Internet Explorer window and
// goto the google website.
IE ie = new IE(http://www.google.com);
// Find the search text field and type Watin in it.
ie.TextField(Find.ByName(“q”)).TypeText(“WatiN”);
// Click the Google search button.
ie.Button(Find.ByValue(“Google Search”)).Click();
// Uncomment the following line if you want to close
// Internet Explorer and the console window immediately.
//ie.Close();
}
}
}
WatiN – how to test site with popup pages
Follow one of these methods to test popup web pages using WatiN.
//after the click that opens the popup:
IE iepopup_1 = IE.AttachToIE(Find.ByUrl(theUrlOfThePopup));
//operate on iepopup_1
IE poppedUpBrowser = IE.AttachTo(Find.ByUrl(“http://www.popped-up-site.co.uk/”));