Forum Discussion

naveen_vastare's avatar
naveen_vastare
Occasional Contributor
14 years ago

How do we get the object reference of top one when multiple instances present in web page


Product: TestComplete


Version: TestComplete v.6.50 Enterprise




In a WebPage having a same data property in multiple Cells as explained below or screen shot is attached


In Web column the data which I want to find is repeated in multiple rows, when I try to find an object of first occurrence row using FindChild function.


Column1


Row1 -- 1.2


Row2 -- 1.2


Row3 -- 1.2 (Find function always finds Row3 object, where I want to find Row1 Object, here I will be knowing only few properties, such as ColumnIndex, innerText and ObjectType )


 


FindChild(Array("ColumnIndex","ObjectType","innerText"), Array("1","Cell","*"+"1.2"+"*"),10)


It always finds an object from bottom and I am getting an object reference from bottom instead of top one. Here the object property of the CELL is same in all the row.


How do we get the object reference of top one when multiple instances present in web page?



1 Reply

  • Hi,



    You need to iterate through the rows of your table and select the first cell in the row where other cells meet some criteria. See the "Parsing HTML Tables" help topic for more information.



    In your case, you can first find the row where the first cell contains "1.2" and then check whether the second cell contains "1.1". If it contains another value, move to the next row and perform the same check.