Difference between Class Name and Class in 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 as Class 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
<input class="buttons" type="submit" />
If we change that to
<input class="UserDefinedButtons" type="submit" />
the spy will now show the class as UserDefinedButtons while Class Name will still be shown as WebButton
I hope the above explanation has answered all your questions around Class Name, class and micclass in QTP.
If you’re into automating web applications, I recommend you to get good knowledge on HTML and CSS. Learning to write HTML/CSS won’t take much time but will help you a long way in your job as an automation tester. In case of any issue, you will be able to think like a developer and that thing alone would help you to resolve those little issues that come up every now-and-then during automation. There are various free and paid courses available on the internet. My recommendation is to try HTML/CSS courses at TeamTreeHouse, I have personally gone through some of their courses and can whole-heartedly recommend them.
If you have any questions, please feel free to ask in the comments section below.
Welcome new readers: Download the Free eBook!
I am Ankur Jain, the owner of LearnQTP and founder of a software organization. This site is run, maintained and updated by me and my team. Feel free to take a look around, you may want to start with What is QTP?
You can connect with me on my Google+ page.
Please enter your first name and email address below to instantly download the eBook on Optimizing QTP Scripts. In future, we will make sure you get new tips & tricks on QTP delivered direct to your email box.