What is child object?
Child object is the method provided by the QTP to extract the collection of object define by you using dynamic descriptive programming .
When programmer define any of the object(like button, link), they define certain properties like html tag, innerHTML,outerHTML,value etc, we are using these properties in our dynamic DP and get the collection of similar objects.
here is the example:
In this example, I am trying ;to find out how many webtable is present in one of our most popular site.
systemutil.Run"iexplore"."http://newtours.demoaut.com/mercuryregister.php"
Set A=description.Create
A("micclass")="WebTable"
A("html tag")="TABLE"
'Setting the object collection
Set ObjDesc=browser("opentitle:=Register: Mercury Tours").page("title:=Register: Mercury Tours").ChildObjects(A)
'Count number of similar objects we found
TabCnt=ObjDesc.count
print TabCnt
'traverse every object
For i=0 to Tabcnt-1 step 1
ObjName=Objdesc(i).getroproperty("name")
msgbox ObjName
ObjRwCnt=ObjDesc.rowcount
ObjClmnCnt=Obdesc.columncount(ObjRwCnt)
print ObrwCnt
Print ObjClmnCnt
Child object is the method provided by the QTP to extract the collection of object define by you using dynamic descriptive programming .
When programmer define any of the object(like button, link), they define certain properties like html tag, innerHTML,outerHTML,value etc, we are using these properties in our dynamic DP and get the collection of similar objects.
here is the example:
In this example, I am trying ;to find out how many webtable is present in one of our most popular site.
systemutil.Run"iexplore"."http://newtours.demoaut.com/mercuryregister.php"
Set A=description.Create
A("micclass")="WebTable"
A("html tag")="TABLE"
'Setting the object collection
Set ObjDesc=browser("opentitle:=Register: Mercury Tours").page("title:=Register: Mercury Tours").ChildObjects(A)
'Count number of similar objects we found
TabCnt=ObjDesc.count
print TabCnt
'traverse every object
For i=0 to Tabcnt-1 step 1
ObjName=Objdesc(i).getroproperty("name")
msgbox ObjName
ObjRwCnt=ObjDesc.rowcount
ObjClmnCnt=Obdesc.columncount(ObjRwCnt)
print ObrwCnt
Print ObjClmnCnt
Next
No comments:
Post a Comment