Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
finding expected value in webtable
#8
Solved: 6 Years, 5 Months, 1 Week ago
Do you mean as soon as the FIRST pass/fail is encountered , the loop should exit ? If yes, use this code


Code:
Function VerifyHistory()
  Dim funcName : funcName = "VerifyHistory"        
  Dim setupFuncName : setupFuncName =   "SETUP|" & funcName

rowcnt = Browser("Br").Page("Pg").WebTable("Tbl").Rowcount
For i = 2 To rowcnt
actual= Browser("Br").Page("Pg").WebTable("Tbl").GetCellData(i,4)
  If Instr(parameter.Item("Activity"),actual)>0 Then
ResultOutput "Pass", "Expected:"&parameter.Item("Activity")&vbnewline,"Actual: "&actual
Exit For
else
ResultOutput "fail", "Expected:"&parameter.Item("Activity")&vbnewline,"Actual: "&actual
Exit For
 End If
   Next

End Function

if you want exactly 1 pass and 1 fail value, use flags to do some manipulation. 

Code:
Function VerifyHistory()
  Dim funcName : funcName = "VerifyHistory"        
  Dim setupFuncName : setupFuncName =   "SETUP|" & funcName
  Dim flagPass, flagFail

rowcnt = Browser("Br").Page("Pg").WebTable("Tbl").Rowcount
For i = 2 To rowcnt
actual= Browser("Br").Page("Pg").WebTable("Tbl").GetCellData(i,4)

  If Instr(parameter.Item("Activity"),actual)>0 Then
ResultOutput "Pass", "Expected:"&parameter.Item("Activity")&vbnewline,"Actual: "&actual
flagPass = 1
else
ResultOutput "fail", "Expected:"&parameter.Item("Activity")&vbnewline,"Actual: "&actual
flagFail = 1
 End If

If (flagPass = 1 and flagFail = 1) Then
Exit For
End If

Next

End Function
Reply


Messages In This Thread
finding expected value in webtable - by Anupama - 05-21-2018, 05:16 PM
RE: finding expected value in webtable - by Ankur - 05-22-2018, 03:08 PM
RE: finding expected value in webtable - by Ankur - 05-22-2018, 04:12 PM
RE: finding expected value in webtable - by Ankur - 05-22-2018, 07:06 PM
RE: finding expected value in webtable - by Ankur - 05-23-2018, 04:04 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to match weblist data with expected values Anupama 5 2,843 05-18-2018, 12:15 PM
Last Post: Ankur
  ALM resource(datatable) not used when expected psova 1 3,300 09-04-2013, 02:45 PM
Last Post: psova
  Not finding Mercury tours website sekmet 0 2,098 11-03-2008, 11:02 PM
Last Post: sekmet

Forum Jump:


Users browsing this thread: 2 Guest(s)