tags:

views:

167

answers:

1

I have a main menu window. On clicking any menu item it opens a child window using window.open? I am writing automated test script for this using Watin. How do i write Test script for the child windows.

+1  A: 

The Watin.Core.IE class has a static AttatchToIE method you can use. It takes a Watin.Core.Constraint object as an argument (i.e. you have to use Find.ById, Find.ByName, etc.) to help Watin find the window you are looking for, and it returns a reference to an IE object.

Example:

IE myIE = IE.AttatchToIE(Find.ByTitle("Child Window Title"));

From there you can use the myIE object to run your tests, make sure it loads, make sure it has the expected text, etc.

Patrick
This worked IE myIE = IE.AttachTo<IE>(Find.ByTitle("Child Window Title"));
Amitabh