QTP removed WinListView the object and sub-object attributes

Original link: http://www.cnblogs.com/emma/archive/2010/03/03/1677225.html

Yesterday a friend asked me how to get to the property Sogou music box play list of songs, I did a little test, combined with some of the functions can be conveniently removed attribute WinListView elements and sub-elements. The following code debugging.

         ReDim Columns(10)
        Set ōbj = Window("搜狗音乐盒").WinListView("SysListView32")
        cColumns = Obj.ColumnCount()
        For iColumn = 0 To cColumns - 1
         Columns(iColumn) = Obj.GetColumnHeader(iColumn)
        Next
        cItems = Obj.GetItemsCount
        For iItems = 0 To cItems - 1
         str ="第 "&iItems+1&" 首歌曲属性列表"& vbCr
         For iColumn =0 To cColumns - 1
           str = str &Columns(iColumn)&" = "& Obj.GetSubItem(iItems ,Columns(iColumn)) & vbCr
         Next
         Msgbox str
        Next
        Set ōbj = nothing


        Important functions described:
        ColumnCount function:. Returns the number of columns in a (report-style) list-view control ----- return list-view how many fields there are
        GetColumnHeader function: Returns the text header of the specified (report- style) list-view column .----- return list-view of the field name
        GetItemsCount function: returns the number of items in the combo box list .----- returns the number of elements in list
        GetSubItem function: returns the text value field value a list-view sub-item ( report-style). ------- returns the list of child elements

Source http: / /softtest.chinaitlab.com/QTP/752224.html

Reproduced in: https: //www.cnblogs.com/emma/archive/2010/03/03/1677225.html

Guess you like

Origin blog.csdn.net/weixin_30438813/article/details/94954126