0

i have a dynamic webtable, where the no of rows and columns depends on the input.Now my Webtable has 8 rows and 11 columns. i need to compare the webtable,rows and columns with the expected result excel sheet before determining if the test case has passed or failed.

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

i have the number of rows and columns...kindly help to proceed further...with the scripting

Mithilesh Indurkar
  • 481
  • 1
  • 5
  • 12

1 Answers1

0

You may need a little debugging on this. There are many ways you can validate. Your question is too broad to give a specific answer. Please provide specific details from your next question

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
Mithilesh Indurkar
  • 481
  • 1
  • 5
  • 12