Search code examples
qtphp-uft

Unable to identify Wbfgrid if it has large number of rows


I have a weird situation where QTP will not identify a WBFgrid if it has a large(800+) rows of data. However it will identify if it has (5-100) rows of data.

Has anyone seen this behavior before and knows of a way to solve this using a QTP setting or something.

Just so people know I was able to come up with a work around for this problem by using DOM. What I am looking for is a way to make it work naturally using QPT.


Solution

  • The problem was with UFT, whenever I had more than 800 rows of data UFT would not recognize the WBFGrid.

    To overcome this problem I accessed the page's internal property and identified the WBFGrid using it's ID. The final code looked something like this.

    Set objWbfGrid = pgSrch.Object.getElementById("WBFGrid_ID")
    
    'Set rows object
    Set objWbfRows = objWbfGrid.childNodes(0).childNodes
    
    intRowCount = objWbfRows.length
    
    For intWbfRow = 1 To intRowCount - 1 Step 1 'skip the first row as it is the header
        Set objCols = objWbfRows.Item(intWbfRow).childNodes
    
        Set objCell = objCols.Item(0) 'The first column has index 0
    
        strCellValue = Trim(objCell.childNodes.Item(0).nodeValue)
    
        'Verify the Distance from member is greater than 30
        If strCellValue = "What I was looking for" Then
            blnMatchFound = True
            Exit For
        End If
    Next