Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
one column of table rows has links - want to access them - any ideas?
#2
Solved: 10 Years, 10 Months, 2 Weeks ago
Please refer to the ChildItem method of the WebTable object under QTP help. You would need to use this method for the CheckBox as well as the Link:

Code:
'CheckBox
.ChildItem(iRow, iCol, "WebCheckBox", iIndex)

'Link
.ChildItem(iRow, iCol, "Link", iIndex)

The 3rd parameter points to the ClassName of the object. 4th is the index relative to the number of similar objects present in the cell.

You can retrieve the number of rows and columns using RowCount/ColumnCount or GetROProperty. You would need to run a loop from the row below the header (generally 2) to the last row/column combination and check for CheckBoxes as well as the links. It should be something like this:

Code:
Const row = 2 '2 because generally the 1st row is the row header
Const col = 1
Dim iRows, iCols
Dim r, c

iRows = Browser("").Page("").WebTable("").GetROProperty("rows")
iCols = Browser("").Page("").WebTable("").GetROProperty("cols")

For r = row to iRows
    For c = col to iCols
        'Check if the cell contains a checkbox
        'You can also write an else for a condition when the checkbox does not exist
        If Browser("").Page("").WebTable("").ChildItem(r, c, "WebCheckBox", 0).Exist(0) Then
            'Check the checkbox in the cell
            Browser("").Page("").WebTable("").ChildItem(r, c, "WebCheckBox", 0).Set "ON"
        End If
    Next
Next

You could run a similar code for the Link..

I hope this helps a little.
Reply


Messages In This Thread
RE: one column of table rows has links - want to access them - any ideas? - by Anshoo_Arora - 03-04-2009, 07:33 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Multiple rows of test data Bhuvana 0 1,224 01-03-2020, 09:30 PM
Last Post: Bhuvana
  [UFT] Get column name from SfwObject felino 0 2,920 12-02-2015, 04:07 PM
Last Post: felino
  Adding data into rows that add dynamically with setcelldata azar81 4 5,686 04-13-2015, 05:24 PM
Last Post: vidya2k2
  Excel operation - to find usedrange of rows & col pooja 1 9,424 02-19-2015, 04:06 AM
Last Post: supputuri
  how to count rows and columns in csv file. venkatesh9032 1 2,671 02-18-2014, 01:28 AM
Last Post: supputuri

Forum Jump:


Users browsing this thread: 1 Guest(s)