Micro Focus QTP (UFT) Forums
How to delete particular mails in Gmail using QTP - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: How to delete particular mails in Gmail using QTP (/Thread-How-to-delete-particular-mails-in-Gmail-using-QTP)



How to delete particular mails in Gmail using QTP - rajkumarsm - 09-02-2014

Hi, Need a script to delete particular mails from gmail using QTP.
Im using QTP 10, IE7.

Sample code: But it is not working properly. Thanks in advance.

Code:
For i = 1 to 10
A = Browser("Inbox.*").Page("Inbox.*").WebTable("Click to teach Gmail this").GetCellData(i,5)
Expected = " me"
Actual = Split(A,",")
'Print Actual(1)
If Expected = Actual(1) Then
'print "Passed"
Set B = Browser("Inbox.*").Page("Inbox.*").WebTable("Click to teach Gmail this").ChildItem(i,1,"WebElement",0)
B.Set "ON"
'Browser("Inbox.*").Page("Inbox.*").webelement("micclass:=WebElement","class:=T-Jo-auh","height:=15","index:=0").click
'Browser("Inbox.*").Page("Inbox.*").webelement("class:=T-Jo-auh","index:=1").click
Else
print "Failed"
End If
Next



RE: How to delete particular mails in Gmail using QTP - rajkumarsm - 10-06-2014

The below code is working perfectly.
Code:
Expected = "Raj"
For i=0 to 10
    Actual  = Browser("Browser").Page("Page").WebTable("WebTable").GetCellData(i,5)
    ActualSplit = Split(Actual,", ")
    'print Actualsplit(0)
    If Expected = Actualsplit(0) Then
        'print "expected=actual"
        Set DP = Description.Create
        DP("micclass").Value = "WebElement"
        DP("class").Value ="T-Jo-auh"
        DP("html tag").Value = "DIV"
        Set DPChkBox = Browser("Browser").Page("Page").childobjects(DP)
        With DPChkBox            
            print DPChkBox.Count
            DPChkBox(i).Click
        End With
        Set Mouse = CreateObject("Mercury.DeviceReplay")
        x=Browser("Browser").Page("Page").WebElement("Delete").GetROProperty("abs_x")
        y=Browser("Browser").Page("Page").WebElement("Delete").GetROProperty("abs_y")
        Mouse.MouseMove x+5,y+5
        Mouse.MouseClick x+5,y+5,LEFT_MOUSE_BUTTON
    Else
        print "expected<>actual"
    End If
Next