Micro Focus QTP (UFT) Forums

Full Version: DP-counting mails
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hi ankur. I h've read u r blog. It is very interesting
It is very useful.thank q so much.
i have one doubt. can u tell me the ans
how can we count the no. of unread mails in gmail inbox by using descriptive programming
i h've tryied but am not getting and count will change when new mail recieved.
thank you
Dear Priya,

Please try this one after that your doubt will be clarified.

Please execute the below steps:
1. Login to the gmail.
2. Click on the checkpoint for inbox after that get the celldata.
3. Finally impliment the below logic

Code:
Browser("Gmail: Email from Google").Page("Gmail - Inbox (1859)").Frame("v1").WebTable("Inbox (1859)").Check CheckPoint("Inbox (1859)")
x=Browser("Gmail: Email from Google").Page("Gmail - Inbox (1859)").Frame("v1").WebTable("Inbox (1859)").GetCellData(2,1)
z= mid(x,8)
msgbox z
counts=left(z,len(z)-1)
msgbox counts


Thanks & Regards,
Durai
Try this:

Code:
sText = Browser("micclass:=Browser").WebElement("innertext:=Inbox.*", "html tag:=B", "index:=0").GetROProperty("innertext")

leftParan = InStr(1, sText, "(")
rightParan = InStr(1, sText, ")")
numOfMails = Mid(sText, leftParan + 1, rightParan - leftParan - 1)

MsgBox numOfMails