Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SCript??
#1
Not Solved
how to check the number of unread emails in gmail using qtp
Reply
#2
Not Solved
'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
plz run this Script
Reply
#3
Not Solved
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
Reply
#4
Not Solved
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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)