In our last post “UFTBasics #6: Object Identification via Mandatory & Assistive properties”, we briefed about how to identify objects in an application using their ‘properties’. The next obvious step is ‘How do you extract the ‘attribute-value’ pair for an object’s properties? This is where Object Spy comes to rescue!
Object Spy is a utility within UFT to,
- Highlight the object.
- Adding objects to Object repository.
- Check the properties of object (also to copy that to clipboard). For e.g. values for object attributes like name, class, outertext, etc.
- Check what all the operations can be performed on the object, say click, select, etc.
Access Object Spy
- From the Tool bar:
2. Tools >> Object Spy
3. Resources >> Object Repository Manager
4. Resources >> Object Repository
Steps to use Object Spy
- Object Spy >> Object Spy Dialog box >> the Objects can be added to the repository upon clicking the pointing hand. Move the hand over the required object and it will provide the properties which are then consumed by UFT for object identification.
2. After spying the object, the object hierarchy will be shown.
3. After Spy >> click on “Highlight” option to highlight the object in the application. Please note that this option is disabled until and unless one object is added to the spy wizard.
4. For adding the object into the Object Repository >> click on “Add objects” button in the Object spy dialog.
5. The properties and its values are displayed for the selected object in the dialog box
6. The supported operations on the object can be retrieved by clicking on the operation tab.
7. Click on this button to copy all the object properties to clipboard.
Object Spy is used to identify an object’s properties to access it through automation script. The general steps are – Click on Object Spy (Hand symbol) >> Hover over the object in the application >> Select it >> Try to highlight (to cross check that correct object is captured) >> Add to OR / Copy to clipboard / Check properties or operations that can be performed on object >> Use it for Automation scripting.