Write a Script in QTP to count the no of buzz messages in a Gmail Account.

We will need to use the GetROProperty method to get the count of the buzz messages in the Gmail Account for a user and this number is dynamic so we use the GetRoProperty method and get the innertext value. We will use the GetROProperty (Get Run Time Object Property) to get the count of the Buzz Messages ex Buzz (25) and then replace Buzz, (,) with a null and then print only the number to the user.


'You need to be logged into the Gmail account
Browser("title:=Gmail.*").Page("title:=Gmail.*").Link("innertext:=Buzz.*","class:=n.*").Click
'To get the innertext of Buzz link
buzzcount = Browser("title:=Gmail.*").Page("title:=Gmail.*").Link("innertext:=Buzz.*","class:=n.*").GetROProperty("innertext")
If buzzcount = "Buzz" Then
Print "No Buzz Messages"
ExitAction
Else
buzzct = Replace(buzzcount, "Buzz","")
buzzct = Rtrim(ltrim(buzzct))
buzzct = Replace(buzzct, "(","")
buzzct = Replace(buzzct,")","")
Print "You have "&buzzct& " Buzz Messages."
End If

2 comments:

RP Singh said...

Oho took time to understand.But really good and impressive programming style.......

jaya said...

Can anyone tell me what replace, RTRIM and LTRIM are doing here?m unable to get it.please help.

Post a Comment

/* Tynt Insight tracker ----------------------------------------------- */