Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Trying to click on WebElement within a WebTable
#2
Solved: 8 Years ago
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.
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 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
Reply


Messages In This Thread
RE: Trying to click on WebElement within a WebTable - by Parke - 11-07-2013, 07:25 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Gain data from a webtable inside a webtable AndyM 1 1,940 07-12-2018, 08:36 PM
Last Post: Ankur

Forum Jump:


Users browsing this thread: 2 Guest(s)