Web Add-in Extensibility Developer Guide > Web Add-in Extensibility API reference > Mercury.QTP.ToolkitManager Namespace > _util Class > _util Class Methods > Wait Method

_util.Wait Method

Suspends execution for a specified interval.


public function Wait( 
   milliseconds : uint


The time interval, in milliseconds.


The following JavaScript function selects a specified book in a WebExtUsedBooks object. After verifying the validity of the specified index, the function selects the corresponding radio button and clicks the Select link. To enable the person running the test to see that the correct radio button is selected, the function calls the _util.wait method to suspend execution for one second before clicking the link.

function SelectBook( BookIndex )
// Select the radio button for the specified index and click the "Select" link.
   if( BookIndex > BookCount() )
      // Display an error message in Internet Explorer.
      _util.Alert("Book index '" + BookIndex + "' is out of range !")
      // Fail the step and cause UFT to display a run-time error.
      throw "Book index is out of range !"

   // Select the radio button corresponding to the specified index.
   // Wait a while to enable users to see that the correct radio button is selected.
   // Click the "Select" link (the 3rd child of the DIV element).
   _util.LogLine("Running SelectBook test object method.",1);