11-07-2013, 07:25 PM
fridlek:
I have been playing with dp and webtables recently and I believe the problem is you should be using "Link" instead of "WebElement".
I have come to the conclusion that every cell in a webtable is a webelement. If we need to do something useful such as click on a link, edit a field, check a webcheckbox, then childitem count is greater than 0 and the count for webelement for that cell is > 0.
Try running the code below and you will see what I mean.
I have not played with the last five items in the array.
I am hoping that someone who knows more than I do can explain why cells with an ID of 578912 or FirstName of Paul are not recognized as a webelement when we attempt to perform a count.
hth,
Parke
I have been playing with dp and webtables recently and I believe the problem is you should be using "Link" instead of "WebElement".
I have come to the conclusion that every cell in a webtable is a webelement. If we need to do something useful such as click on a link, edit a field, check a webcheckbox, then childitem count is greater than 0 and the count for webelement for that cell is > 0.
Try running the code below and you will see what I mean.
Code:
''// http://qaautomationqtp.blogspot.com/2013/07/examples-of-working-with-webtable-in-qtp.html
Public Function func_findObjectinaWebTable(strMicclass,intRow,intCol)
''// This does not work with WebElement, the count is always zero
strmicclass = trim(strMicclass)
'print BrowserName & ": " & tableName
objChildCnt=Browser("name:="&browserName).Page("title:="&pageTitle).WebTable("name:="&tableName).ChildItemCount(CInt(introw),CInt(intcol),strMicclass)
print "cnt = " & objChildCnt
If objChildCnt >0 then
print "objChildCnt = " & objChildCnt
print "row " & introw & ", col, " & intcol & ", Micclass " & strMicclass
End if
End Function
' If any web objects are missing, add them to the array
webObjects_arr = array("Link", "WebButton", "WebCheckBox", "WebEdit","WebElement", "WebTable", "Image", "WebList", "WebRadio", "WebRadioGroup")
' the table I used had 5 rows and 5 columns
For numRow = 1 to 5
For numCol = 1 to 5
For i = 0 to ubound(webObjects_arr)
strMicclass = webObjects_arr(i)
Call func_findObjectinaWebTable(strMicclass,numRow,numCol)
Next
Next ''// numCol
Next ''// numRow
I am hoping that someone who knows more than I do can explain why cells with an ID of 578912 or FirstName of Paul are not recognized as a webelement when we attempt to perform a count.
hth,
Parke