This topic contains tips for recording TruClient scripts.
Strings are expressed between quotes. For example,
City is interpreted as a variable whereas
'City' is evaluated as a string.
Work with the ArgsContext object
Object identification variables and step variables do not share the same context. This means that variables that are defined in one context are not recognized in the other. To use a variable in object identification that is defined in the Arguments section of a step, add the prefix ArgsContext before the variable name.
For example, if the variable firstname is defined as a value for an argument of a step, use the firstname variable in object identification, refer to the variable as ArgsContext.firstname.
For an example of using ArgsContext in a for loop, see How to Insert and Modify Loops in TruClient.
Use regular expressions
Use the '/' notation: Replace the quotation marks of a string with a slash.
/LoadRunner/is a regular expression that will match any string that contains "LoadRunner".
If you need to dynamically create a regular expression, you can use the regular expression constructor and specify the string. For example, the equivalent of the above example is RegExp("LoadRunner"). You can use parameters in the RegExp constructor.
The AUT API provides a common mechanism for handing the AUT window and document for all TruClient protocols: Web, Mobile Web, and Native Mobile (when working on an element within a WebView).
For TruClient Web protocols, the API also works without the AUT prefix to support backward compatibility.
For security reasons, the AUT.window API cannot access the JavasSript written in the AUT's window.
AUT.window. Points to the global window object of the application.
AUT.document. The global document object of the application.
var elem = AUT.document.getElementById('myInput');