Syntax Guidelines

Note: This protocol is supported for replay only. Support for this protocol will be discontinued in future versions..

We recommend that you migrate your Ajax Click & Script scripts to another web protocol such as TruClient-Web or Web-HTTP/HTML.

For details, see Web Vuser Functions (WEB) and TruClient protocols in the VuGen Help Center (select the relevant version).

This section contains general guidelines to understanding the syntax and coding of AJAX functions.

The Argument List

Function arguments are divided into sections by delimiter arguments: DESCRIPTION, ACTION, and LAST. The function argument lists have three main sections:

  • The first section, up to the first delimiter, contains the step name and other general information.

  • The DESCRIPTION section contains descriptors that identify the specific instance of the object on which the function acts. The class of object (for example, browser, button, and text area) is implied by the function name, except web_element where the class can be specified with the TAG descriptor. The DESCRIPTION section is not required if the object is the only one of its type in the test context or where the first object of its type is used regardless of its attributes.

  • The ACTION section specifies the action taken and any associated values. The ACTION section is not required when the default action is taken.

With the exception of stepname, which is identified by its being the first argument, all the function's arguments are identified by their keyword. For example, BrowserTitle is specified with this format: "BrowserTitle=Welcome to Pemberley".

The first argument is always the stepname, even if the format looks like "KeyWord=Value". It other words, if you enter "BrowserTitle=Welcome to Pemberley" as the first argument, the stepname is "BrowserTitle=Welcome to Pemberley".

Coding Guidelines

Delimiters (DESCRIPTION, ACTION and LAST) are entered in capital letters and without quotation marks.

Always include the LAST delimiter.

Keywords are not case sensitive. For example, "WindowType=PopUp" and "WINDowtYpe=PopUp" are equivalent.

Do not enter white space before or after a keyword. For example, " WindowType =PopUp" is not recognized.

Values that are limited to a predefined list (for example, Regular , Modeless, or PopUp, which are the predefined values for WindowType) are not case sensitive. For example, "WindowType=REGULAR" and "WindowType=RegulaR" are equivalent.

Values that are not limited to a predefined list, however, are sometimes case sensitive.

Do not enter leading or trailing white space unless it is part of the value. For example, "Name= submit_button " (with spaces) is not equivalent to "Name=submit_button".

Parameterization only applies to values, for example, "WindowType={WinTypeParam}". You cannot parameterize the entire argument (Keyword=Value) or the keyword part of the argument. Neither "{KeywordEqValueParam}" nor "{KeywordParam}=value" is recognized.

Usually, specifying an argument as an empty string is not equivalent to omitting it. For example, specifying "Name=" in the DESCRIPTION section restricts the matches to elements with an empty or omitted name, whereas if the Name descriptor is not passed to the function, element identification is based on the other descriptors and the name of the element is ignored.

Normalization of Arguments

During the recording process and when regenerating a script, VuGen normalizes the argument values:

  • Leading and trailing spaces are removed.

  • Carriage returns (\r) and line feeds (\n) are removed.

  • Each tab (\t) is replaced with a space.

For example, during the recording process, if you clicked on a button whose HTML definition contains name=" ab\r\nc ", the spaces and \r\n are removed, so that the argument in the VuGen script is "Name=abc". As a result, the argument value "abc" as it appears in the VuGen script does not appear as the button name in the log files or the HTML source of the web page.

If normalization causes a problem, use a parameter or program constant for the value. Do not simply edit the recorded value because your correction will be lost if you regenerate the script.

Regular Expressions (REs)

If the keyword is of the form Keyword/RE, the argument can take a regular expression as its value.

For more information, see Regular Expressions.