Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Count the number of times the object appeared in the run
#3
Solved: 11 Years, 5 Months, 2 Weeks ago
Hi,

As Basanth said you can use the Counter Variable. Below is a sample code from Flight Reservation Application, which gives the useage of Counter variable in Reporter Events.

Also, you can see the Screen Shot which gives the No. of Pop-Up's displayed for each Pop-Up Dialog's.

Code:
Dim a,k
a= DataTable.GetRowCount

For i=1 to a
    DataTable.SetCurrentRow(i)
    b=DataTable.Value("AgentName",dtGlobalSheet)
    c= DataTable.Value("Password",dtGlobalSheet)
    d= DataTable.Value("CorrectPassword",dtGlobalSheet)
    e= DataTable.Value("DateofFlight",dtGlobalSheet)
    f= DataTable.Value("FlyFrom",dtGlobalSheet)
    
    Dialog("Login").WinEdit("Agent Name:").Set b
    Dialog("Login").WinEdit("Password:").Set c
    Dialog("Login").WinButton("OK").Click
    
    If Dialog("Flight Reservations").Exist Then
        k=k+1
        Reporter.ReportEvent micPass, "Verify Flight Reservations Dialog","Flight Reservation Pop-Up dialog is displayed "&"-"&"No of Pop-Up's:" & k
    End If
    Dialog("Flight Reservations").WinButton("OK").Click

    Dialog("Login").WinEdit("Password:").Set d
    Dialog("Login").WinButton("OK").Click

    wait 5

    If Window("Flight Reservation").Exist Then
        Reporter.ReportEvent micPass,"Verify Flight Reservation dialog","Flight Reservation Dialog is displayed"
        Else
        Reporter.ReportEvent micFail,"Verify Flight Reservation dialog", "Flight Reservation Dialog is Not displayed"
    End If

    Window("Flight Reservation").ActiveX("MaskEdBox").Type e
    Window("Flight Reservation").WinComboBox("Fly From:").Select f

    If Window("Flight Reservation").Dialog("Flight Reservations").Exist  Then
        k=k+1
        Reporter.ReportEvent micPass,"Verify Flight Reservations dialog","Flight Reservation Pop-Up dialog is displayed "&"-"&"No of Pop-Up's:" &k
        
    End If
    Window("Flight Reservation").Dialog("Flight Reservations").WinButton("OK").Click

Next


Cheers,
Deepak.Bhandarkar


Attached Files Image(s)
   


Messages In This Thread
RE: Count the number of times the object appeared in the run - by qtpdeepak - 10-07-2009, 03:19 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  swfwindow object name getting changed after each run saniya 1 1,751 10-10-2018, 09:02 PM
Last Post: TheGlovner
  Web Object Unique ID Number zunebuggy 0 1,598 07-10-2017, 05:37 PM
Last Post: zunebuggy
  QTP not recogonising object during run time Lavanya N 2 3,781 10-28-2015, 12:46 PM
Last Post: vinod123
  VB Script to count number of links in a web page. Suma Parimal 4 25,444 07-01-2015, 12:59 PM
Last Post: govind
  General run error. Line (18): "Loop while Browser("Index:=0").Object.Busy" AshokReddy 3 5,185 12-20-2013, 01:44 PM
Last Post: sshukla12

Forum Jump:


Users browsing this thread: 2 Guest(s)