''' <summary>
''' GetAllRowsWithCellText 搜索新增数据是否在数据列表存在
''' </summary>
''' <param name="webTable" type="">--table</param>
''' <param name="columnnum" type="">--指定搜索列</param>
''' <param name="text" type="">--搜索的数据</param>
''' <returns type="">--返回搜索累计数</returns>
Function UI_Web_GetAllRowsWithCellText(objWebTable,columnnum,text)
Dim i,j,rowcellvalue,y,n,textnum
y = 0
n = 0
textnum = 0
If objWebTable.RowCount > 1 Then
If columnnum <> 0 Then
For i = 2 To objWebTable.RowCount - 1
rowcellvalue = objWebTable.GetCellData(i,columnnum)
If Trim(rowcellvalue) = Trim(text) Then
y = y + 1
textnum = y'1
UI_Web_GetAllRowsWithCellText = textnum
Exit Function
Else
UI_Web_GetAllRowsWithCellText = textnum
Exit Function
End If
Next
Else
For i = 2 To objWebTable.RowCount - 1
For j = 1 To objWebTable.ColumnCount(1)
rowcellvalue = objWebTable.GetCellData(i,j)
If Trim(rowcellvalue) = Trim(text) Then
y = y + 1
textnum = y'1
UI_Web_GetAllRowsWithCellText = textnum
Exit Function
Else
UI_Web_GetAllRowsWithCellText = textnum
End If
Next
Next
End If
Else
UI_Web_GetAllRowsWithCellText = textnum
End If
End Function
'产品搜索
''' <summary>
''' Product_Search 产品搜索,组合搜索
''' </summary>
Sub Product_Search()'搜索新增产品
Dim param,RowNumber
param = Excel_GetRowColumnBySheetName( "D:\产品管理.xls","产品参数",2,1)'读取参数
With ProductFrame
.WebEdit("产品名称").Set param
.WebButton("查询").Click
RowNumber = UI_Web_GetAllRowsWithCellText(.WebTable("产品名称"),1, param)
If RowNumber >= 1 Then
call Set_Reporter("产品管理","Pass","step1","产品搜索","新增产品在数据列表内存在!")
ElseIf RowNumber = 0 Then
call Set_Reporter("产品管理","Fail","step1","产品搜索","新增产品在数据列表内不存在!")
End If
End With
End Sub
QTP之WebTable----搜索指定的数据
最新推荐文章于 2021-07-22 17:37:52 发布