0

我有一个动态 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

我有行数和列数...请帮助进一步进行...使用脚本

4

1 回答 1

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
于 2017-07-11T12:55:52.997 回答