HttpWatch Automation Reference - Version 11.x
HttpWatch Namespace / Controller Class / Wait Method
A reference to a Plugin object in which the page is being loaded.

The number of seconds to wait for the current web page to finish loading or a value of -1 to specify an infinite timeout.

Values between 0 and 5 seconds are not valid and will cause Wait to return an error. The reason for this is that Wait checks for 5 seconds without HTTP activity after the page load event has fired. If you supplied a value equal to or less than 5 seconds, a timeout would always occur during the first wait after loading a page. Please see the Remarks section for more information.


In This Topic
    Wait Method
    In This Topic
    Waits for a page to be fully loaded in the browser instance that contains the specified plug-in.
    Syntax
    'Declaration
     
    Public Function Wait( _
       ByVal plugin As Plugin, _
       ByVal timeOutSecs As Integer _
    ) As Boolean
    public bool Wait( 
       Plugin plugin,
       int timeOutSecs
    )

    Parameters

    plugin
    A reference to a Plugin object in which the page is being loaded.
    timeOutSecs

    The number of seconds to wait for the current web page to finish loading or a value of -1 to specify an infinite timeout.

    Values between 0 and 5 seconds are not valid and will cause Wait to return an error. The reason for this is that Wait checks for 5 seconds without HTTP activity after the page load event has fired. If you supplied a value equal to or less than 5 seconds, a timeout would always occur during the first wait after loading a page. Please see the Remarks section for more information.

    Return Value

    Returns true if the page finished loading during the specified timeout period and false if loading had not completed by the end of the timeout.
    Remarks

    The Wait method doesn't return until either:

    • The timeout period specified by timeOutSecs has elapsed
    • The page load event has fired and there has been a lack of HTTP activity for 5 seconds

    A lack of HTTP activity means that no new requests are recorded and all existing requests have completed. This allows your automation code to capture any HTTP traffic that is generated by JavaScript executing after the page is initially loaded.

    If the behavior of Wait doesn't fit your requirements use the WaitEx method instead. It allows you to specify exactly the exact criteria required when waiting for a page to load.

    The Wait method is the equivalent of calling the WaitEx method with the following parameters:

     

    Wait/WaitEx methods
    Copy Code
    // Calling WaitEx with waitForPageLoadEvent set to true
    // and a 5 second value for httpIdleSecs
    controller.WaitEx( plugin, myTimeOutValue, true, false, 5);
    
    // Is the equivalent to calling Wait
    controller.Wait(plugin, myTimeOutValue);
    
    Wait can only be used if Record has been called on the Plugin object.
    Requirements
    Returns true if the page finished loading during the specified timeout period and false if loading had not completed by the end of the timeout.
    See Also