Tutorial-2 How to View Object Properties by using Object Spy
This short tutorial guides you to a method by which you can view the Object Properties & Methods with the help of Object Spy in QTP.
We can look at the Properties and Methods of any object with the help of Object Spy pointing hand mechanism, provided the application is open. As we move the pointing hand over the objects in the application, their Details get displayed in the Object Spy.
These details displayed in the Object Spy are the test object’s hierarchy tree, its properties and values, and the methods related to the object. For methods, the syntax is also displayed.
Steps to view test object properties or methods:
Step-1: Open the application plus the concerned page having the particular object where we desire to use the Spy function.
Step-2: Select Tools -> then Object Spy or click the Object Spy toolbar button. This will display the dialog box of Object Spy along with the Properties tab.
Alternatively from the dialog box of the Object Repository, we can click on the Object Spy button for getting the same function
Step-3: Select the details we want to view for the object.
- Click Run-time Object Properties or Test Object Properties.
- To view the object�s available methods and syntax, click the Methods tab. Properties tab is displayed by default, enabling us to view the object�s properties and values.
Step-4: In the Object Spy dialogs box, click the pointing hand. QuickTest remains hidden. As we move the hand shaped pointer across the test objects in our application, the test objects get highlighted, and we can view their test object properties or methods in the Object Spy dialog box. We can also view their parent objects in the object hierarchy tree area of the Object Spy dialog box.
Step-5: Highlight or click on the particular objects whose properties or methods we wish to see. The Object Spy displays the object hierarchy tree and the properties or methods of the object that is selected within the tree.
Click the object whose associated methods we want to view. The object hierarchy tree gets displayed by the Object Spy along with necessary details for the selected object according to our selection.
Step-7: Click on the radio button of Test Object Properties to see the properties or methods of the test object. Click on the radio button of Run-time Object Properties to see the properties or methods of the Run-time Objects.
Step-8: For seeing the properties, values, or methods for some other object present in the displayed tree, highlight or click on the particular object and select the relevant options, as described in step 3 above.
Step-9: For copying some object property or its value, or a method’s syntax over our Clipboard, we can click on the property, value, or method to highlight it. The value gets displayed over the property value box or method syntax box, which is, located above the Description box. Highlight the text in the box & use Windows standard copy command like CTRL + C for copying the desired text over Clipboard. Alternatively we can do right-click over the text after highlighting it and selecting Copy command from the main menu.