_util.Alert Method

Opens a modal message box displaying the specified message.


In the following situations, the message box is not displayed:

  • When your support runs on a browser with protected mode ON
  • When your support runs on Internet Explorer 9


public function Alert( 
   message : String


The message to display.


The following JavaScript function selects a specified book in a WebExtUsedBooks object. Before attempting to select the book, the function checks the validity of the specified index. If the index is out of range, the SelectBook function calls the _util.Alert method to display an error message box in the browser, in addition to throwing an exception to cause the test to fail.

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);