02-14-2013, 03:48 PM
how to check the number of unread emails in gmail using qtp
|
SCript??
|
|
02-14-2013, 03:48 PM
how to check the number of unread emails in gmail using qtp
02-14-2013, 05:04 PM
'You need to be logged into the Gmail account
Code: Browser("title:=Gmail.*").Page("title:=Gmail.*").Link("innertext:=Inbox.*").Click
Browser("title:=Gmail.*").Page("title:=Gmail.*").Sync
'To get the innertext of inbox link
inboxcount = Browser("title:=Gmail.*").Page("title:=Gmail.*").Link("innertext:=Inbox.*").getroproperty("innertext")
If inboxcount = "Inbox" Then
Print "No Unread Emails."
ExitAction
Else
emailcount = replace(inboxcount, "Inbox","") 'replaces inbox with space
emailcount = Rtrim(ltrim(emailcount)) 'removes all the spaces
emailcount = replace(emailcount, "(","")
emailcount = replace(emailcount, ")","")
Print "You have "&emailcount& " unread emails in your inbox."
End If
02-15-2013, 08:39 PM
Code: 'Login to gmail Account
Browser("opentitle:=Gmail.*").Page("title:=Gmail.*").WebEdit("name:=Email").Set "username"
Browser("opentitle:=Gmail.*").Page("title:=Gmail.*").WebEdit("name:=Passwd").Set "password"
Browser("opentitle:=Gmail.*").Page("title:=Gmail.*").WebButton("name:=Sign in").Click
Browser("opentitle:=Gmail.*").Page("title:=Inbox.*").Link("innertext:=Inbox.*").Click
Browser("title:=Gmail.*").Page("title:=Gmail.*").Sync
' Get unread emails count
sLink= Browser("opentitle:=Gmail.*").Page("title:=Inbox.*").Link("innertext:=Inbox.*").GetROProperty("innertext")
'msgbox sLink
If sLink = "Inbox" Then
iEmails = 0
Msgbox "Total Unread Email(s) " & iEmails & " No New email"
Exit Action
else
'Split unread emails count from Inbox(XX)
iEmails = Split(sLink, " ")(1) 'have total number of unread email count as (XX)
iEmails = Replace(iEmails, "(", "") ' this statement have partial number as XX)
iEmails = Replace(iEmails, ")", "") 'antoher replace ) to blank sapce statement as XX
Msgbox "Total Unread Email(s) " & iEmails
End If
02-16-2013, 02:31 PM
To add to the above script, I am able to login successfully to gmail. But when I tried to click on Inbox I am getting the error.
Browser("name:=Inbox.*", "hwnd:=854422").page("title:=Inbox.*","hwnd:=852998").Link("innertext:=Inbox.*").click Error is seen as below: Cannot find the "[ Link ]" object's parent "[ Browser ]" (class Browser). Verify that parent properties match an object currently displayed in your application. I am using QTP 10 trail version, Windows 7 ultimate OS, IE 8 Plx let me know if you need any other info. |
|
« Next Oldest | Next Newest »
|