Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Gmail: Compose Mail Functionality
#1
Not Solved
I never thought I have to struggle 12 hrs to automate ‘compose mail’ functionality in gmail. But still I am unable to execute it successfully. I have been struggling to identify the objects of ‘compose mail link”, “To text box”, “subject text box”, “send button”. I can understand it is a simple issue but in real I am struggling,

The code i am using.
'*****************************************************
Code:
If  Browser("title:=Gmail.*").Page("title:=Gmail.*").WebElement("innertext:=Compose Mail", "html id:=:rd", "html tag:=B").Exist Then
    Browser("title:=Gmail.*").Page("title:=Gmail.*").WebElement("innertext:=Compose Mail", "html id:=:rd", "html tag:=B").Click -9999, -9999
    Browser("title:=Gmail.*").Page("title:=Gmail.*").Sync
    If Browser("title:=Gmail.*").Page("title:=Gmail.*").WebEdit("name:=to", "class:=dK nr l1", "rows:=2").Exist Then
        Browser("title:=Gmail.*").Page("title:=Gmail.*").WebEdit("name:=to", "class:=dK nr l1", "rows:=2").Set "<xyz@gmail.com> "
        If  Browser("title:=Gmail.*").Page("title:=Gmail.*").WebEdit("name:=subject").Exist Then
            Browser("title:=Gmail.*").Page("title:=Gmail.*").WebEdit("name:=subject").Set "hi"
            If  Browser("title:=Gmail.*").Page("title:=Gmail.*").WebButton("name:=Send").Exist Then
                Browser("title:=Gmail.*").Page("title:=Gmail.*").WebButton("name:=Send").Click -9999, -9999
                Browser("title:=Gmail.*").Page("title:=Gmail.*").Sync
            Else
                   MsgBox( "Send button Not found")
                
            End If
        Else
            MsgBox( " Subject text box Not found")
            
        End If
    Else
        MsgBox( "To text box not found")
            End if
Else
    MsgBox( "Compose Mail link not found")
    
End If

'***************************************************
In some runs, some of the objects are being identified by QTP and in the next run same objects are not being identified.

I thought i would use Object repositary to store the objects and get them identified. But the above mentioned objects are lying under frames whose name starts with 'c'. So i cant use c.* for all the frames.

Note: Before you suggest any code, please run it once on gmail and if it is passing then only put down here. Otherwise i end up loosing more time in implementing your code.

In some posts i read use the below to click on compose mail

Code:
Browser("title:=Gmail.*").WebElement("html id:=:rd").Click

but i didn't work

Thanks,
kishore
Reply
#2
Not Solved
Here is the code which is working. Thanks to Anshoo arora the moderator.

Code:
With Browser("title:=Gmail.*").Page("title:=Gmail.*")
    If .WebElement("innertext:=Compose Mail", "html tag:=SPAN").Exist(10) Then
        .WebElement("innertext:=Compose Mail", "html tag:=SPAN").Click
        If .WebEdit("name:=to").Exist(10) Then
            .WebEdit("name:=to").Set ""
            If .WebEdit("name:=subject").Exist(10) Then
                .WebEdit("name:=subject").Set "hi"
                Setting.WebPackage("ReplayType") = 2
                If .WebElement("innertext:=Send", "html tag:=B", "index:=0").Exist(10) Then
                    .WebElement("innertext:=Send", "html tag:=B", "index:=0").Click
                    .Sync
                Else
                    MsgBox( "Send button Not found")
                End If
                Setting.WebPackage("ReplayType") = 1
            Else
                MsgBox( "Subject text box Not found")
            End If
        Else
            MsgBox( "To text box not found")
        End if
    Else
        MsgBox( "Compose Mail link not found")
    End If
End With
Reply
#3
Not Solved
But why we use Exist(10)... I dont understand it.. please let me know/
Thanks
Adi
Reply
#4
Not Solved
Exist is used to check if the object is present in the screen and do the operations on the object.

for example, ,

Code:
Browser("").Page("").Image("").Exist(5)

If we use the code above QTP will wait a maximum of 5 seconds for the Image("") object to appear. If it appears, it will execute the next line of code.

If the object doesn't appear with in 5 seconds, the step will fail.

Hope you got it.

Thanks,
Elango
Reply
#5
Not Solved
I am trying to delete email from gmail account and I am stuck. I have tried different combination but no luck.

Code:
If  Browser("name:=Your CarMax validation code.*").page("Title:=Your CarMax validation code.*").webtable("class:=Bs nH iY").Exist   Then
Browser("name:=Your CarMax validation code.*").page("Title:=Your CarMax validation code.*").webtable("class:=Bs nH iY").Webtable("class:=cf gJ").Image("class:=hA T-I-J3").Click
' Click delete this message on the fly out , below line should click the delete this message but not clicking
'giving error as too many web element.
Code:
'Browser("name:=Your CarMax validation code.*").page("Title:=Your CarMax validation code.*").webtable("class:=Bs nH iY").webelement("class:=cj", "outtertext:= Delete this message").Click

End If

Finally I got it work by below line of text
1) read the email you want to delete by getrowtextcell("Gmail")

2) Now click the trash can on top bar.
Code:
Browser("name:=.*").page("Title:=.*").webelement("class:=T-I J-J5-Ji nX T-I-ax7 T-I-Js-Gs ar7").Submit

But I would like to delete by fly out "delete this message" option as above code delete all the mails which are grouped by that text.
Reply
#6
Not Solved
Now working code doesn't work, I am back to square 1.. Need help
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  To send Fail Results to mail Naresh 1 2,561 04-23-2015, 08:30 PM
Last Post: babu123
  To send the QTP Results to mail using Thunderbird Naresh 0 2,425 04-03-2015, 03:19 PM
Last Post: Naresh
  How to delete particular mails in Gmail using QTP rajkumarsm 1 4,202 10-06-2014, 07:03 PM
Last Post: rajkumarsm
  Delete Gmail email newqtp 4 4,770 07-05-2013, 02:12 PM
Last Post: Staff
  Total no of mail in gmail excellentpawan 2 3,206 07-05-2013, 01:56 PM
Last Post: Staff

Forum Jump:


Users browsing this thread: 1 Guest(s)