Difference between Class Name and Class in QTP

上一篇 / 下一篇  2013-10-29 13:32:49 / 个人分类:QTP

When you spy on an any object in QTP, it shows two different properties Class Name and class.Ever wondered what is the difference between the two?


Let me show this with the help of an example -

Shown below is a simple HTML button.

When you use Object Spy on this button, Class Name will be WebButton while class will be shown as buttons.

Class Name is the basic essence of that object. If Class Name gets changed the object itself would get changed. Hence, an object of type button will always be shown as WebButton under Class Name, a hyperlink would always be shown as Link, a browser object would always be shown as Browser and so on. A point to note here is that, while object spy shows the property asClass Name, the same property should be written as micclass while using Descriptive Programming.  For ex:

class is a selector used for styling purposes in HTML. This property can take any user defined name as defined by the developer of your application. In this example, we have defined

If we change that to

the spy will now show the class as UserDefinedButtons while Class Name will still be shown asWebButton





Open Toolbar