Posts Tagged ‘Browser(“miccclass:=Browser”).Page(“micclass:=Page”)’

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!!