Hi everyone,

I've been reading this forum for quite some time and often found suggestions and help good enough for me to figure my problems out by myself.

Unfortunately, my current issue does not fall into this category, that's why I would appreciate some help.

We are currently developing a framework based on QTP using descriptive Programming to access Gui elements in several Web applications. Everything does in fact run pretty well, but accessing certain objects in tables still does not work from time to time.

We're facing the issue that different tables, although they look the same, are implemented in many different ways. It's out of the questions to have all the tables reimplemented within, let's say, the next decade, so that's why it's our problem to make it work.

Here's a short example of how different the tables can be:
- the table header and the table data can be in one or two tables
- the table header and the table can have a different amount of cells as well as invisible or very small cells, columns or rows for formatting purposes
- the space between the tables or rows can differ

What I basically want to do is this:
"Click on a certain button in the row where certain data matches my testdata"

Right now we have this implemented in a pretty complicated way which can summed up as
1. Describe your header table and the space between your header table and the data table
2. Look for certain data in the header table, for example the column with the innertext "Name"
3. Remember the x-position of the cell
4. Move down on the y-axis until you have reached a cell where the innertext equals my tesdata, for example where the name is "Tothtoth"
5. From there, move on the x-axis until you reach a cell where you find the WebButton with the alt-attribute "edit" and click on that button

This approach actually works in our testing framework (even with multiple conditions like name=Tothtoth, gender=male), but as more and more differently implemented tables emerge, the exceptions also increase.

So I got the idea to implement a new way of working with tables which basically plans to filter out all of the unnecessary stuff like style information or empty cells to reduce the table to an array containing the Objects that I want to work with (i.e. WebElements, WebLinks, WebButtons).

Right now, my code looks like this (the table I work with is "parentTable"):

<font class="small">Code:</font><hr /><pre>
Dim rowCount
Dim columnCount
Dim rowCounter
rowCount = parentTable.RowCount()
'array representation of the table
Dim virtualTable()
ReDim virtualTable(0)
virtualTable(0) = null
Dim currentRow()
ReDim currentRow(0)
virtualTable(0) = null

For rowCounter = 1 to rowCount
columnCount = parentTable.ColumnCount(rowCounter)
'Ignore all columns with one or less columns
If columnCount &gt; 1 Then
If IsNull(virtualTable(0)) = FALSE Then
'Redimension table
ReDim Preserve virtualTable(UBound(virtualTable)+1)
End If

'Create a new Array with the number of columns of the row
Dim columnCounter
For columnCounter = 1 to columnCount
MsgBox("Number of Objects at Position " &amp; rowCounter &amp; "-" &amp; columnCounter &amp; ": " &amp; parentTable.ChildItemCount(rowCounter, columnCounter, "WebElement"))
If parentTable.ChildItemCount(rowCounter, columnCounter, "WebElement") &gt; 0 Then
If IsNull(currentRow(0)) = FALSE Then
'Redimension row
ReDim Preserve currentRow(UBound(currentRow)+1)
End If
Dim webelementCounter
For webelementCounter = 1 to parentTable.ChildItemCount(rowCounter, columnCounter, "WebElement")
'MsgBox(parentTable.ChildItem(rowCounter, columnCounter, "WebElement", webelementCounter-1).Exist(5))
<font color="red">'--&gt; True </font>
'MsgBox(parentTable.ChildItem(rowCounter, columnCounter, "WebElement", webelementCounter-1).getROProperty("Class Name"))
<font color="red">'--&gt; Works for the first column, then it's always "" </font>
'MsgBox(parentTable.ChildItem(rowCounter, columnCounter, "WebElement", webelementCounter-1).getROProperty("innertext"))
<font color="red">'--&gt; Works for the first column, then it's always "" </font>
'MsgBox(parentTable.ChildItem(rowCounter, columnCounter, "WebElement", webelementCounter-1).getTOProperty("anything"))
<font color="red">'Test run always crashes when trying to access any TOProperty </font>
'MsgBox(parentTable.ChildItem(rowCounter, columnCounter, "WebElement", webelementCounter-1).toString())
<font color="red">'For testing purposes, always prints "" </font>
'MsgBox(parentTable.ChildItem(rowCounter, columnCounter, "WebElement", webelementCounter-1).Object.height)
<font color="red">'Test run always crashes when trying to access any "Object"-property </font>
'Set currentRow(UBound(currentRow)) = parentTable.ChildItem(rowCounter, columnCounter, "WebElement", 0)
End If
virtualTable(UBound(virtualTable)) = currentRow
MsgBox("Row set")
End If
</pre><hr />

I simply iterate through the table ignoring certain cells and only using WebElements. Unfortunately, when I try to access any Properties of these WebElements, I don't get any values or the test run crashes (marked red). I hope it's just a matter of some index being wrong and not an issue with the "WebTable.ChildItem"-Method.

Any suggestions?

(Sorry about the lengthy introduction to my problem, I was hoping it helped describing the kind of environment I'm working in. If it simply adds confusion, ignore it :-) )