Step Helper for Web UI Testing with WatiN

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.

Advertisement

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();
    }
  }
}