What is micclass in qtp ?


Micclass in qtp

Micclass in qtp

What is micclass in qtp ?

It stands for Mercury interactive class constant.But it is shown as Classname in QTP environment.
eg:Properties=Class name and Value=Browser,so don’t get confused.

SystemUtil.Run “iexplore.exe”,”https://automationlab09.wordpress.com”
sFetchedURL=Browser(“micclass:=Browser”).Page(“micclass:=Page”).GetROProperty(“url”)
Msgbox sFetchedURL

Following is the wrong way of it’s usage:
———————————————————–
Browser(“Class Name:=Browser”)

Correct way is:

Browser(“Micclass:=Browser”)
———————————————————-

Example:

Click on the forgot password link on the login window:

Solution 1:
Browser(“miccclass:=Browser”).Page(“micclass:=Page”).Link(“text:=Forgot Password”).Click

Solution2 :

Set oDesc = Description.Create
oDesc(“text”).Value = “forgot password”

Browser(“miccclass:=Browser”).Page(“micclass:=Page”).Link(oDesc).Click

Browser(“miccclass:=Browser”).Page(“micclass:=Page”).Link(oDesc).Click

Solution3:

Set oDesc = Description.Create

oDesc(“html tag”).value = “A”
oDesc(“text”).Value = “forgot password”
Browser(“miccclass:=Browser”).Page(“micclass:=Page”).childobjects(oDesc).Click

———————————————————–
Do’s and Dont’s:

If there is “forgot password?” instread of “forgot password” :

By default QTP treats all DP properties as regular expression patterns eg: “forgot password?” is treated as forgot password hence, it throws out an error as “Cannot identify object”.This happens because there is no such text as “forgot password” ie.?(question mark) is missing from the text.

Solution: Use regular expression in order to cope up with this problem.

Browser(“miccclass:=Browser”).Page(“micclass:=Page”).Link(“text:=forgot password\?”).Click

Solution 2 :

Set oDesc = Description.Create
oDesc(“text”).Value = “forgot password?”
oDesc(“text”).RegularExpression = False ‘It doesn’t treat the text as regular expression

Now QTP treats it as forgot password? 🙂

Cheers!!

Advertisements

5 responses to this post.

  1. Posted by Xman on August 9, 2010 at 3:23 pm

    I have a problem about micclass. I have following code below:
    Const olFolderInbox = 6
    Set oFolder = oIMAPI.getDefaultFolder(olFolderInbox)
    HTMLText = email.HTMLBody
    SystemUtil.Run “iexplore.exe”
    Browser(‘micclass:=Browser”).Sync
    Browser(“micclass:=Browser”).Object.document.write HTMLText
    …..

    The above code work fine in my QTP9.5 on windows 7. But The code don’t work on my coleague’s PCs which are same as mine – Windows 7 with QTP 9.5. There is an error message displayed as Can’t identify object…., The running stuck at Browser(‘micclass:=Browser”).Sync. It looks like their PC don’t recognized micclass.

    I did a lot different way to find reason, but I can’t. Can anyone help to find out reason?

    Thanks.

    Xman

    Reply

    • Hello Xman,

      –>Browser(‘micclass:=Browser”).Sync

      one single quote is missing before text M on micclass, plz replace it with Browser(“micclass:=Browser”).Sync

      Hope it’ll work.

      Reply

  2. Posted by Xman on August 10, 2010 at 9:24 pm

    Thanks for reply. Sorry fat finger. I typed the above piece of code instead of copy.

    Actually, Browser(“micclass:=Browser”).Sync in my QTP. Do I ask my colleagues to have some special setup. I do not have any special set to have this piece of code work on my PC. Waiting for your reply.

    Thanks.

    Xman

    Reply

  3. Xman,
    on analyzing the above code, i guess you are trying to read the contents of the mail from a particular folder in Ms Outlook application.If it’s working on 1 pc then there must be a problem of content inconsistency.

    The expected folder,expected email with same subject/content might not exist on your colleagues PC. or MS outlook itself has not been configured with the settings you are using.

    Reply

  4. Posted by lucky on February 13, 2013 at 9:14 am

    Hi,
    I am also trying to write HTMLbody of the mail to IE 8 by using QTP 11 but getting general run error at — Browser(“micclass:=Browser”).Object.document.write HTMLBody

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: