11-19-2010, 12:51 AM
I'm trying to create a script using QTP to compose an email in Gmail.
So far I have the login working but am unable to locate the compose mail webElement using descriptive programming. Please take a look at my code and offer any feedback that might help. Thanx.
Here is my code so far...
So far I have the login working but am unable to locate the compose mail webElement using descriptive programming. Please take a look at my code and offer any feedback that might help. Thanx.
Here is my code so far...
Code:
Dim ie
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.Navigate "www.gmail.com"
'Define variables for Gmail Home Page
Dim objBrowser, objGmailHmPg, objUser, objPass, objSignIn
'create browser object
Set objBrowser = Description.Create()
objBrowser("title").value = "Gmail: Email from Google - Windows Internet Explorer"
'Create Gmail Home Page object
Set objGmailHmPg = Description.Create
objGmailHmPg("title").value = "Gmail: Email from Google"
'Create user name textbox object
Set objUser = Description.Create()
objUser("html tag").value = "INPUT"
objUser("type").value = "text"
objUser("name").value = "Email"
'Create password textbox object
Set objPass = Description.Create()
objPass("html tag").value = "INPUT"
objPass("type").value = "Password"
objPass("name").value = "Passwd"
'Create sign in button object
Set objSignIn = Description.Create()
objSignIn("name").value = "Sign in"
Browser(objBrowser).page(objGmailHmPg).WebEdit(objUser).Set "xxxxx@email.com"
Browser(objBrowser).page(objGmailHmPg).WebEdit(objPass).Set "password"
Browser(objBrowser).page(objGmailHmPg).WebButton(objSignIn).Click
Set objCompose = Description.Create()
objCompose("innertext").value = "Compose mail"
objCompose("html tag").value = "DIV"
If Browser("title:=Gmail - Inbox.*").Page("title:=Gmail - Inbox.*").Frame("html tag:=IFRAME", "html id:=canvas_frame").WebElement(objCompose).Exist Then
msgbox "true"
else
msgbox "false"
End if
ie.Quit