Virtual object in UFT
UFT works on standard objects. If any application contains non-standard objects, then to work with them UFT provides a utility to map them as standard objects.This utility is called ‘ Virtual Objects’.
By using virtual object wizard, we can map non-standard objects to standard objects.Let’s see how to use them.
We will take the example of cell in an excel sheet.If we do object spy on the cell, then it shows hierarchy ‘Window–> Winobject’. Let’s map it with a object in virtual object wizard.
To open virtual object wizard, go to ‘Tools –> Virtual Object–> New Virtual Object’. It will open a window given below.
Click on Next and at the next window select the class as ‘object’.
After selecting class, click Next. On the next screen, we have button called ‘Mark’. Click on that and mark the object in AUT(Application under test). It will capture the width and height of the object.
After marking the object, click on next. On next window, it will show object configuration. Select the option ‘Entire parent hierarchy’.
Next window will ask you to give any name to the object and it shows the collection name where this object will be added.
We have given the name ‘MyCell’. Click on Finish button.
Now, to see the usage of created virtual object, you have to start recording and click on the cell in Excel. The virtual object will be captured like shown below.
Window("DemoExcel1").WinObject("DemoExcel1").VirtualObject("MyCell").Click 23,12
There are few points about virtua objects which we should know.
1. To disable virtual objects in UFT while recording, choose the option “Disable recognition of virtual objects while recording” under “Tools->Options->GUI testing ->Genaral”.
2. This features is not used for Analog and low level recording mode.
3. As we can see. virtual object relies on the width and height.So,it is not good to depend on them.