So just briefly, WatiN was inspired by WatiR and is used to perform front end web application testing. WatiN is coded in .net languages and it provides a mechanism to automatically load Internet Explorer, find controls and perform actions and then assert conditions. You can find out more info here: http://watin.sourceforge.net/
Ok now thats done, here is my tips for the week:
Problem:
Each time I load a test I want to run it in a new process so my session information is clearedSolution:
With version 1.2 of WatiN there is a new argument to allow you to start IE in a new process:
IE ie = new IE(someUrlToGoTo, true))
Problem:
I want to obtain a collection of fields. For example, I have a repeater which contains a text field and I don't know how many repeater items may be returned but I want to grab all text fields.Solution:
Use a filter to get a collection
TextFieldCollection valueTextFields = browser.TextFields.Filter(Find.ById(new Regex("ValueTextBox")));
Problem:
I want to find a field but its type isn't available in WatiN
Solution:
Use the Element object
Element item1 = ie.Element("li", Find.ById("item1"));
Problem:
I don't want the Internet Explorer windows used during testing to be visible to the user
Solution:
Change the IE setting
IE.Settings.MakeNewIeInstanceVisible = false; // default is true
No comments:
Post a Comment