Forum Discussion

theamitpandey's avatar
theamitpandey
Occasional Contributor
10 years ago

Calculate the total delay during the script run


Hi, 



I have script which uses delays at various points.



Is it possible to calculate the total actual delay during the script execution.



I need to provide a metric of the



actual script execution time = total script execution time - delay time .



Thanks.


2 Replies

  • Hi,



    You can initialise a global variable total_delay = 1000 and use this function to Add delay to objects.Log this after the end of every script and then reset it to 1000 before staring execution of next script.



    Function AddDelay(obj_type,obj_name)

      

      Set Window = Aliases.IE.Page("*")

        cycle = 120

        count = 0     

        Do While Not (window.NativeWebObject.Find(obj_type,obj_name).Exists)

         Delay(1000)

          count = count +1

          total_delay = total_delay + 1000

          if count = cycle Then 

            Log.Error("Required ' "&obj_name&" ' not found on page.Please look into the issue.")

            Exit Do

          End If

        Loop

       

    End Function



    Thanks,

    Neha