A virtual object in UFT is used to identify an object when UFT can’t recognize it using objects standard class.UFT doesn’t recognize an object if it is a custom or non-standard class object. If an application contains non-standard class objects, in that situation custom objects, can be mapped to standard class objects like buttons, checkboxes, etc to perform the required action.
Let’s try to understand this by automating the click operation on the ‘SAVE” button of MSPaint. If you use object spy to view its properties, UFT identifies the entire MSPaint upper bar as a single WinObject rather than identifying the “SAVE” icon as a single object.
We will create a virtual object to treat the save icon as a button object. Go to the Tools> Virtual Object> New Virtual Object and click on the “Next” button.
We will create a virtual object to treat the save icon as a button object. Go to the Tools> Virtual Object> New Virtual Object and click on the “Next” button.
We will map the SAVE object against the Class button and click “Next”.
Click on the “Mark Object” Button and capture the width and height of the object and press the “Next” button.
Select the parent object of the virtual object and click “Next”.
Now you will have to give a valid name of the object. In our case, the name is “btnSave“.Click the “Finish” button.
Now, to use the virtual object, you have to start recording and click on the Save icon. The below code will be generated automatically.
Window(“Paint”).VirtualButton(“btnSave”).Click
Limitations of Virtual Object
- UFT does not support virtual objects for analog or low-level recording mode.
- Virtual objects can be added to the script only by recording action on it.
- A checkpoint can be added to a Virtual Object.
- Virtual Objects cannot be added by Object Repository.
- A custom object can be mapped to a particular class like (button, checkbox, table, etc). However, all the methods of the native objects are not supported by Virtual objects.
- The test execution will fail if the screen resolution changes.
- The virtual object uses height and width properties which might change.
Recommended Posts
- How to Use Visual Relation Identifier in UFT with Example
- Micro Focus UFT Tutorial – An Overview of UFT
- All You Need to Know About Object Identification in UFT
- The Ultimate Cheat Sheet on Step Generator in UFT
- How To Add Checkpoints in UFT
- Create User-Defined Functions in UFT
- All You Need to Know about Checkpoints In UFT