QTP - Object Spy
Object Spy is a utility/option within QTP to add objects to the Object Repository. Object Spy can be accessed from the tool bar as shown below −
Step 1 − Clicking the Object Spy icon, the Object Spy Dialog box opens. The Objects can be added to the repository on clicking the pointing hand.
Step 2 − After Spying the object, the object hierarchy will be shown. Let us say, we are spying the "Numbers" link at "http://easycalculation.com/". The Object properties will be as shown below.
Step 3 − After Spying an object, click the "Highlight" option to highlight the object in the application.
Step 4 − For adding the object into the Object Repository, click the "Add objects" button in the Object spy dialog.
Step 5 − The properties and its values are displayed for the selected object in the dialog box, which should be unique for QTP, to recognize the objects while the script executes.
Step 6 − The supported operations on the object can be retrieved by clicking the operation tab. Operations such as "click" for a button, "Set" for a text box are retrieved from the "operations" tab as shown below −