Interview Questions   Tutorials   Discussions   Programs   Videos   

QTP - In QTP, how to write a descriptive program for "yahoo" or "Gmail" Login page?




286
views
asked marvit September 16, 2014 07:14 AM  

In QTP, how to write a descriptive program for "yahoo" or "Gmail" Login page?


           

1 Answers



 
answered By Dharma   0  
Function GmailLogin(sUserName, sPassword)
    GmailLogin = False

    With Browser("title:=Gmail.*").Page("micclass:=Page")
        'Check if the UserName field exists
        If .WebEdit("html id:=Email").Exist(0) Then
            .WebEdit("html id:=Email").Set sUserName    'Set UserName
            .WebEdit("html id:=Passwd").SetSecure sPassword    'Set Password
            .WebButton("name:=Sign in").Click        'Click Submit
            .Sync
        End If

        'Check for Link Inbox(xyz)
        If .Link("innertext:=Inbox.*").Exist(15) Then GMailLogin = True
    End With
End Function

'Usage 1:
MsgBox GmailLogin("yourUserName", "yourPassword")

'Usage 2:
If GmailLogin("yourUserName", "yourPassword") = True Then
    'Continue with test
Else
    'Stop
End If
flag   
   add comment

Your answer

Join with account you already have

FF

Preview


Ready to start your tutorial with us? That's great! Send us an email and we will get back to you as soon as possible!

Alert