Thursday, March 8, 2007

Spying on GUI Objects

Spying on GUI Objects
To help you understand how WinRunner identifies GUI objects, examine the objects in the sample Flight Reservation application.
1 Start the Flight Reservation application.
Choose Programs > WinRunner > Sample Applications > Flight 1A on the Start menu. The Login window opens.
2 Start WinRunner.
Choose Programs > WinRunner > WinRunner on the Start menu. In the Welcome window, click the New Test button. If the Welcome window does not open, choose File > New.
3 Open the GUI Spy. This tool lets you "spy" on the properties of GUI objects.
Choose Tools > GUI Spy. The GUI Spy opens. Position the GUI Spy on the desktop so that both the Login window and the GUI Spy are clearly visible.
4 View the properties that provide a unique description of the OK button.
In the GUI Spy, click the Spy button. Move the pointer over objects in the Login window. Notice that each object flashes as you move the pointer over it, and the GUI Spy displays its properties. Place the pointer over the OK button and press Left Ctrl + F3. This freezes the OK button’s description in the GUI Spy.

5 Examine the properties of the OK button.
At the top of the dialog box, the GUI Spy displays the name of the window in which the object is located and the object’s logical name. In the Recorded tab, the property names and values that would be recorded are listed. For example, "label OK" indicates that the button has the text label "OK", and "class push_button" indicates that the button belongs to the push button object class. As you can see, WinRunner needs only a few properties to uniquely identify the object.
6 Take a few minutes to view the properties of other GUI objects in the Login window.
Click the Spy button and move the pointer over other GUI objects in the Login window. If you would like to view an expanded list of properties for each object, press Left Ctrl + F3 to stop the current Spy, and then click the All Standard tab.
7 Exit the GUI Spy.
Click Close.