Get column value of Flex Datagrid by QTP

 

' get the number of rows in the table
rowCount=Browser("Browser").FlexApplication("App").FlexApplication("Fl exClient").FlexPanel("FlexPanel").FlexCanvas("App Home").FlexPanel("Search Results").FlexDataGrid("searchResults").GetItemsCount

 

userFound = FALSE

For myRow = 1 to rowCount
        'select the row
        Browser("Browser").FlexApplication("App").FlexApplication("FlexClient ").FlexPanel("FlexPanel").FlexCanvas("AppHome").FlexPanel("Search Results").FlexDataGrid("searchResults").SelectIndex(myRow -1) ' indexes start at 0
        'get the data contents of the row (the columns are pipe separated)           
        rowData = Browser("Browser").FlexApplication("App").FlexApplication("FlexClient ").FlexPanel("FlexPanel").FlexCanvas("App Home").FlexPanel("Search Results").FlexDataGrid("searchResults").GetROProperty("selecteditem")
        'report the row data
        Reporter.ReportEvent micDone,"Search Results Row " &myRow,rowData
        'split the row data into an array: one element per column
        aRowData=split(rowData,"|")
       
        ' see if the UserName column matches what we want to select
        If myUser <> "" Then
                ' the strings must match exactly
                If trim(aRowData(0)) = myUser Then
                    userFound = TRUE

                    exit For
                End If
        End If
Next

原文地址:https://www.cnblogs.com/ellie-test/p/3288728.html