Seeing similar queries often in my mail box these days, so I decided to record a couple of videos.
In case, If you haven’t counted emails in standard view (of Gmail) using QTP earlier, I would suggest you to attempt it now. It becomes a bit interesting especially if you have never worked on frames before. Also watch the videos below it has a couple of methods to deal with dynamic objects and frame objects.
Counting number of emails in basic HTML view…
Counting number of emails in standard view…
This is the function in the videos above to extract the number from Inbox string –
msgbox mid(strText, instr(1,strText,"(") + 1, (instr(1,strText,")") - instr(1,strText,"(") - 1))
If you want to keep track of further articles on UFT (QTP). I recommend you to subscribe by email below and have new UFT articles sent directly to your inbox.
ranga says
sLink = p.link(“name:=inbox.*”).GetROProperty(“name”)
msgbox sLink
iEmails = Split(sLink, ” “)(1)
iEmails = Replace(iEmails, “(“, “”)
iEmails = Replace(iEmails, “)”, “”)
Msgbox “You have “& iEmails &” New Emails”
Viplav says
Oh..
Perhaps i saw a bit in hurry that day..
thanks for your patience to replicate the code.. 🙂
rashmikant parmar says
@ Viplav
Mails = Browser(“Gmail – Inbox”).Page(“Gmail – Inbox”).Link(“Inbox (15)”).GetROProperty(“text”)
vP1 = Instr(1, vMails, “(“,1)
vP2 = Instr(1, vMails, “)”,1)
If vP10 AND vP20 Then
vMails = Mid(vMails, vP1 + 1, vP2 – vP1 -1 )
Else
vMails = 0
End If
Msgbox “You have “&vMails&” New Emails”
Viplav says
@Rashmikant Parmar IN your code above
I was trying to figure out if the below code is correct ?
If vP1 0 AND vP2 0 Then
vMails = Mid(vMails, vP1 + 1, vP2 – vP1 -1 )
Else
vMails = 0
End If
prakash says
Thanks Ankur for nice posting
Azad says
Thanks Ankur for nice posting. Kindly keem on posting such article it really helps learner a lot and i have been definately benifciated a lot. Thanks
JOhn says
i am interested to record and run following thing using QTP and fill all values in DataTable
i will explain it by example
1. Open Url http://www.codeproject.com/KB/aspnet/
2. You will get articles on following topic
* ASP.NET – Cookies
* ASP.NET – Data
* ASP .NET – General
* ASP.NET – Howto
* ASP.NET – Printing
* ASP.NET – Reporting
* ASP.NET – Samples
* ASP.NET – Utilities
* ASP.NET – Web Parts
3. I think this is WebControl ListView
4. i would like to get all tiles according to Asp.Net Categories as following in dataTable of Qtp of Each webPage by click automatically
ASP.NET – Cookies
ASP.NET – Data
ASP .NET – General
ASP.NET – Howto
ASP.NET – Printing
Beginner’s Guide To ASP.NET Cookies
Pivoting DataTable Simplified
SDLC Checklist for Globalized ASP.Net Web Applications.
Providing Web Applications with Context Sensitive Help Using RoboHelp WebHelp
Merge Landscape and Portrait PDFs using ASP.NET
Muruganandhan says
Hi…I am ok with your code, why this logice to be used…
Simple like Msgbox Replace(strText,”Inbox “,””)
Pratap H S says
sibina , capture the last page object and check with .Exists or u can take the last page unique property and check weather its returning TRUE or FALSE .
Regards
Pratap H S
prataphs@gmail.com
sibina says
Ankur,
Can you please explain how to check whether the last page is displayed or not when we click on “Last button” from the pagination bar.
Sibina
Sesha reddy says
Good
Bommy says
Hey Ankur, U r giving wonderfull KT to QTP learners, gr8 job guy,thanks.
Jayachandra Reddy says
Hi Ankur,
Really Gr8 and Nice Articles you posted really helps to freshers to experienced person in field of automation.. Really Nice Work .. I learned alot with ur blogs.. Thanks alot…
Srinivas Rao says
Hi Friends,
I want to learn qtp from realtime guys in hyderabad ,if interested mail me srinivas.mamidla@gmail.com,
thanks in advance
srinivasulu.t says
It is very help to me that code, i am saying really thanks to Ankur, But Ankut i want some clarrification that is :- How Count the number of mails in gmail in standard view (u r saying that is only unread mails. But i want total number of mails in gmail
Rashmikant Parmar says
It is an excellent Idea. you are correct we can customize according to the requirement. I just want to share the point of customization that we can do with this beautiful idea. I greatly appreciate your inputs in the field of Test Automation. I love this website and learned a lot when I was preparing for QTP certification which I cleared last month with the great help of this website.
vijay says
hi it very excelent
Rashmikant Parmar says
Thanks you Ankur. Nice piece of work. But the only problem with this code displayed in video to capture the no of emails is, it will fail if there is no emails. Following code will work for both the situation.
This is for HTML view.
vMails = Browser(“Gmail – Inbox”).Page(“Gmail – Inbox”).Link(“Inbox (15)”).GetROProperty(“text”)
vP1 = Instr(1, vMails, “(“,1)
vP2 = Instr(1, vMails, “)”,1)
If vP1 0 AND vP2 0 Then
vMails = Mid(vMails, vP1 + 1, vP2 – vP1 -1 )
Else
vMails = 0
End If
Msgbox “You have “&vMails&” New Emails”
Ankur says
@Rashmikant: Correct. The idea was to show the approach. It can be customized depending upon the requirement.
Sunny says
Very useful and interesting tips and pieces of code. Thaks a lot for all these points to learn and explore more on tool.