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.

Virtua 1

To open virtual object wizard, go to ‘Tools –> Virtual Object–> New Virtual Object’. It will open a window given below.

Virtual object 1

 

Click on Next and at the next window select the class as ‘object’.

Virtual object 3

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.

Mark virtual object

After marking the object, click on next. On next window, it will show object configuration. Select the option ‘Entire parent hierarchy’.

Virtual 2

 

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.

Virtual 3

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”.

Virtual 4

 

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.

 

Avatar photo

Shekhar Sharma

Shekhar Sharma is founder of testingpool.com. This website is his window to the world. He believes that ,"Knowledge increases by sharing but not by saving".

You may also like...