我有一个动态的webtable,其中行和列的数量取决于输入。现在我的Webtable有8行和11列。我需要在确定测试用例是否通过之前,将webtable,行和列与预期结果excel表进行比较。
introwcount=browser("SAP Transcation iView").Page("SAP Transaction iView").SAPFrame("Generate Leave Entitlement").WebTable("WebTable).RowCount
for r = 1 to introwcount
intcolcount=browser("SAP Transaction iView").Page("SAP Transaction iView").SAPFrame("Generate Leave Entitlement").WebTable("WebTable").ColCount(r)
next
我有行数和列数...请使用脚本
进一步继续...答案 0 :(得分:0)
您可能需要对此进行一些调试。您可以通过多种方式进行验证。您的问题太广泛,无法给出具体答案。请在下一个问题中提供具体细节
introwcount=browser("SAP Transcation iView").Page("SAP Transaction iView").SAPFrame("Generate Leave Entitlement").WebTable("WebTable).RowCount
intcolcount=browser("SAP Transaction iView").Page("SAP Transaction iView").SAPFrame("Generate Leave Entitlement").WebTable("WebTable").ColCount(r)
Set objExcel = CreateObject("Excel.Application")
Set objWorkBook = objExcel.WorkBooks.Open(FilePath)
set objSheet = objWorkBook.Sheets(SheetName)
intSheetRowCount = objSheet.UsedRange.Rows.Count
intSheetColCount = objSheet.UsedRange.Columns.Count
blnFlag = True 'setting the default value first
If intSheetRowCount <> introwcount OR intSheetColCount <> intcolcount Then
blnFlag = False
End if
If blnFlag = true Then
for r = 1 to introwcount
for c = 1 to intcolcount
strExcelValue = ""
strTableValue = ""
strExcelValue = objSheet.Cells(introwcount, intcolcount).value
strTableValue = browser("SAP Transcation iView").Page("SAP Transaction iView").SAPFrame("Generate Leave Entitlement").WebTable("WebTable).GetCellData(introwcount,intcolcount)
If (strComp(strExcelValue, strTableValue, 0) <> 0 Then
blnFlag = False 'Used for resulting purpose
End If
Next
Next
End If
if blnFlag = True then
msgbox "Pass"
Else
msgbox "Fail"
End If
Set objSheet = Nothing
objWorkBook.Close
Set objWorkBook = Nothing
objExcel.Quit
Set objExcel = Nothing