This can be done using Description Object and ChildObjects. Description object creates a Properties collection object. It has a method 'Create'. This method creates an empty description object in which you can add collection of properties and values in order to specify the description object in place of a test object.
ChildObjects returns the collection of child objects within the object.
If in the above example if the five List boxes have the same name, html id and class. To identify each of the listbox uniquely,
Set obj = Description.create()
obj("micclass").value = "WebList"
obj("class").value= "abc"
obj("name").value = "List1"
obj("html id").value = "htm1"
Set newObj = Browser("...").page("...").ChildObjects(obj)
obj("micclass").value = "WebList"
obj("class").value= "abc"
obj("name").value = "List1"
obj("html id").value = "htm1"
Set newObj = Browser("...").page("...").ChildObjects(obj)
Here instead of specifying each of the Listboxes by its properties, we identify them as newObj(0), newObj(1), newObj(2), newObj(3)
so, to select an item "abc' from third List box in this browser
Browser("...").page("...").newObj(2).Select "abc"
To display the number of similar child Objects with the same description
MsgBox newObj.Count
No comments:
Post a Comment