For the selected UI event, you can add or modify custom highlighting rules. These rules can be used when the element that is being highlighted needs special handling, such as calling a javascript function for some custom control. They can also be used for debugging or alerting purposes when specific user actions or values are displayed in a session.
In the dialog, the element identifier is pre-populated with the regular expression pattern to identify the selected event through element ID or XPath.
When the UI event is detected, RTV evaluates the JavaScript™. The following is the default JavaScript:
alert("elementId: %1\r\nelementValue: %2\r\nelementName:
%3\r\nelementXPath: %4\r\neventType: %5");
tealeafCustomUIEventReturnFunc = function ()
{
var ret = new Array();
if ("%1".length) {
ret[0] = document.getElementById("%1");
} else {
ret[0] = TeaLeaf_Client_tlGetNodeFromXPath("%4");
}
ret[1] = "normal"; // RTV action: none, normal, or highlight-only
//ret[2] = "%2"; // new value, optional
return ret;
}
When RTV evaluates the JavaScript, no setting of values, highlighting or clicking is done. The JavaScript defines the appropriate values on which to act.
In the default JavaScript, the function
tealeafCustomUIEventReturnFunc
is called by RTV. This function returns an array
that contains 2 or 3 items:
Array item | Description |
---|---|
ret[0] |
Identifies the object to highlight. If this array element is set to 0, RTV uses its normal method of finding the element to use (id or xpath). |
ret[1] |
The action for RTV to take. Accepted values:
|
ret[2] |
(Optional) If present, this variable contains the value to be set for the element, which is applied only if the second array value is set to {{normal}. |
The default JavaScript can be customized to complete any function that is needed to highlight and replay the document element.
You can reference the following parameters in the JavaScript that you define:
Parameter | Description |
---|---|
%1 |
Internal element identifier |
%2 |
Value of the UI element |
%3 |
Name of the UI element |
%4 |
XPath value of the UI element |
%5 |
UI event type This option enables custom highlighting based on user interface events. |