How to spy an object in QTP using object spy tool?

Object spy in QTP

Object spy is the tool, which is used to spy the Test and run time objects for looking at properties and methods supported by object being spied.

The spy will be used to view the run time or test object properties and methods of any object in open application, use the object spy pointer to point an object, the object spy displays the selected objects’ hierarchy tree, it displays the run time or test object properties and values of the selected object in the properties tab, it displays the run time or test object methods with the selected object in the methods tab.

Object spy tool in qtp

Ways to spy objects in QTP

  1. Through file toolbar, in the File toolbar click Object spy button(an icon showing a person with hat)
  2. Press CTRL+R to open Object Repository, then click object spy button

How to view object properties using object spy

Open browser or application containing the object to be spy

Choose Tools->Object Spy to open the object dialog box and display the properties tab or alternatively click the object Spy button from the Object repository dialog box

In the object spy dialog box, click the pointing hand, both Quick test and the object spy are minimized so that any object can be clicked in the open application

If the object which want to be spied can only be displayed by performing an event(such as a right click or a mouse over to display a context menu) hold The CTRL key, the pointing hand temporarily turns in to a standard arrow and the event can be performed, when the object on which want to be spied is displayed, release the CRTL key, the arrow becomes a pointing head again.

Click the object for which the properties want to be viewed, the object spy returns to focus and displays the object hierarchy tree and the properties of the object that is selected within the tree.

In order To view the properties of the test object, use test object properties radio button(click test objects), to view the properties of the run time object use run time objects radio button,

If you want to view another object property, then choose the objects in the tree and click it.

To copy a property of an object  or value to the clipboard, click the property or value the value is displayed in the selected property/value box, high light the text in the selected property/value box and use CRTL+C to copy the text to the clipboard or right click the highlighted text and choose copy from the menu.

Object spy -Properties and Methods

To copy the entire property, use the copy icon next to add objects to object repository.

Additional features of object spy in version 11 compare to version 9.2

  1. Can copy the entire property to clipboard
  2. Given a shortcut to Highlight objects in application
  3. Given a shortcut to add object to object repository.

After successful spied on any object, object properties can be seen under property tab, Under Method tab what are the actions can be performed against that properties are available.

Leave a Reply

Your email address will not be published. Required fields are marked *