_util.Record Method

Adds a step to the test and adds a test object to the object repository if it is not already there.

Remarks

Use this method in a JavaScript function that records a step in a test after an event occurs on a control.

Syntax

JScript 
public function Record( 
   methodName : String,
   parameters : Object[],
   delay : int
);

Parameters

methodName
The name of the recorded test object method.
parameters

The parameters for the recorded test object method.

This argument is a SafeArray. To convert an array to a SafeArray, you can use the toSafeArray(array) function that Web Add-in Extensibility provides. This function is defined in <Web_Add-in_Extensibility_installdir>\dat\Extensibility\Web\Toolkits\common.js.

delay

For future use.

Must be 0.

Example

The following JavaScript function supports recording a step in UFT when a user selects a date in a .NET ASP AJAX Calendar during a recording session:

function OnSet()
{
  if ( _elem.value && _elem.value != "" )
  {
     var arr = new Array();
     arr[0] = _elem.value;
     _util.Record( "Set", toSafeArray(arr), 0);
  }
  return true;
}

The recorded step will be similar to this one:

Browser("Calendar Sample").Page("Calendar Sample").ASPAjaxCalendar("ctl00_SampleContent_Date1").Set "10/22/2008"