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.

Syntax

JScript 
public function Wait( 
   milliseconds : uint
);

Parameters

milliseconds
The time interval, in milliseconds.

Example

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.
   GetTableElem().rows[1+BookIndex].cells[0].children[0].click();
   // Wait a while to enable users to see that the correct radio button is selected.
   _util.Wait(1000);
   // Click the "Select" link (the 3rd child of the DIV element).
   _elem.children[2].click();
   _util.LogLine("Running SelectBook test object method.",1);
}