Pages

Tuesday, 18 October 2011

Script to find and tick all the checkboxes on the QTP Helper login screen.



Dim objDescription
Dim objCheckBoxes
Dim iCount

' create description objects used to locate check boxes
Set objDescription = Description.Create()

' set the object properties so it looks only for web check boxes
objDescription("micclass").Value = "WebCheckBox"

' check that the user isn't already logged in
If Browser("Title:=QTP Helper.*").Page("Title:=QTP Helper.*").WebButton("Name:=Logout").Exist(1Then

    ' click logout
    Browser("Title:=QTP Helper.*").Page("Title:=QTP Helper.*").WebButton("Name:=Logout").Click 

End If

' get the check boxes from the page
Set objCheckBoxes = Browser("Title:=QTP Helper.*").Page("Title:=QTP Helper.*").ChildObjects(objDescription)

' for each check box found
For iCount = 0 to objCheckBoxes.Count - 1

    ' tick the check box
    Browser("Title:=QTP Helper.*").Page("Title:=QTP Helper.*").WebCheckBox(objCheckBoxes(iCount)).Set "ON"

Next

0 comments:

Post a Comment