Description Object:

‘**********************************************************************************************
‘Login into Gmail Application using Description Object
‘**********************************************************************************************


Public Function DescLogin()
Set objBrowser = Description.Create()
objBrowser("micclass").Value = "Browser"
objBrowser("title").Value = "Gmail: Email from Google"

Set objPage = Description.Create()
objPage("micclass").Value = "Page"
objPage("title").Value = "Gmail: Email from Google"

Set objEdit = Description.Create()
objEdit("micclass").Value = "WebEdit"
objEdit("name").Value = "Email"
objEdit("html id").Value = "Email"

Set objEditPwd = Description.Create()
objEditPwd("micclass").Value = "WebEdit"
objEditPwd("name").Value = "Passwd"
objEditPwd("html id").Value = "Passwd"

Set objWebButton = Description.Create()
objWebButton("micclass").Value = "WebButton"
objWebButton("name").Value = "Sign in"

Browser(objBrowser).Page(objPage).WebEdit(objEdit).Set "balaraju.s"
Browser(objBrowser).Page(objPage).WebEdit(objEditPwd).SetSecure "4bb2f19db7f5c050ac18ca29f3cb094e38986be6f7404b0a"
Browser(objBrowser).Page(objPage).WebButton(objWebButton).Click

End Function

‘**********************************************************************************************
‘**********************************************************************************************
'GETTING CHILD OBJECTS AND PERFORMING OPERATIONS
‘Let us assume, QuickTest is unable perform click operation on particular link in a specific page. Resolution is like getting all the child objects of type Link and can click with VB Scripting.
‘**********************************************************************************************


Public Function funcClickOnLink()
‘Creating Description Object with common properties of links
Set objDescLink = Description.Create()
objDescLink ("micclass").Value = "Link"
objDescLink ("html tag").value="A"

‘Capturing all the child links from the page
Set objLinks = Browser("title := Gmail: Email from Google").Page("title:=Gmail:   Email from Google").ChildObjects(objDescLink)

‘Getting the Link Count
intLinkCount = objLinks.Count

‘Repeating the loop intLinkCount of times
For i = 0 to intLinkCount

‘Getting the InnerText of every link
strLinkText = objLink(i).getroproperty("innertext")

‘If found required link, click and exit for
If strLinkText = "About Gmail" Then

                                    objLinks (i).Click
                                    Exit For
End If

Next

End Function

‘**********************************************************************************************

No comments:

Post a Comment