Micro Focus QTP (UFT) Forums

Full Version: How to click only unread mails in Gmail using vb script
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Thanks in Advance!!

would any one help me in answering or guideing me to this question
how to write a vb script code with QTP to click on the only unread E-mails from gmail or yahoo.
Again, it would be better if you can come up with the issue you are facing while scripting/recording/running.
We do not encourage giving full solutions as such. The expectation is that user should try to come up with his/her own solution after getting a hint for approaching the problem.
[quote=Ankur]
Again, it would be better if you can come up with the issue you are facing while scripting/recording/running.
We do not encourage giving full solutions as such. The expectation is that user should try to come up with his/her own solution after getting a hint for approaching the problem

Hi Ankur,

Iam not looking for a solution but looking for approach !
how do u write a script or approach to click on only unread mails in gmail.. If you record clicking on unread mails and play it back the Qtp will not recognise the unread mails again so how do u make QTP understand that
ok...new question sounds better.

The reason why qtp doesnt recognize, if you replay back the recorded script is because the no of emails get changed everytime right?

You can use regular expression on those (changing) numbers.
tnxs Ankur,

Let me try it out!!!
Ankur!

I think these regular expressions are used for check points...but there is a different logic invloved i guess to click onto this unread gmails.i think its not so easy as u r thinking?
did u try it any time anything of this sort.

If yes plz do guide me!!!..........
sorry for the typo!

if u click onto the unread Emails in the Gmail or yahoo....
2nd Hint: Take a look at regular expression forum and read all threads in it, probably you can find a way to reach your answer.
Hi,

I wrote a small piece of code to check unread mails in gmail.
try it.

Code:
Set excel = CreateObject("Excel.Application")
excel.Workbooks.Open("C:\gmail.xls")
Set sheet = excel.Sheets("Sheet1")

Set objLink = Description.Create()
objLink("html tag").value = "A"

Set objSearch = Browser("title:=Gmail.*").Page("title:=Gmail .*").ChildObjects(objLink)
row = 1
For i=35 to 84 'There are many links but mail (subject) link starts from index 35. Presuming that there are 50 mails per page

     str = objSearch(i).getROProperty("innerhtml")

     If instr(1,str ,"<B>",1)>0 Then 'identifies unread mail by checking whether the font is bold
        sheet.cells(row,1) = objSearch(i).getROProperty("innertext") ' Writes the subject of unread emails in excelsheet from row.
        row=row+1
        j=j+1 'Counts total number of unread mails
     End If

Next

excel.ActiveWorkbook.Save
excel.Quit
msgbox "You have " & j &" unread mail(s)"
im getting "General run error"
[attachment=1135][attachment=1135]
Pages: 1 2