TruClient step structure
This topic explains how to use the Script Editor to manage steps in your TruClient script, and describes the components of a step.
Manage steps using the Step Editor
Steps are structures that contain a user action to perform, object identification, and the point where the next step can start.
To view or manage steps recorded in your TruClient script, click the open or close icon on the right side of the step to open the Step Editor.
The sections and data you can edit depend on the type of step.
You can do the following to manage the steps:
Action | How to |
---|---|
View step details | To display the individual components of a step which includes step, argument, and object, click to the left of Step, Arguments, or Object. |
Arrange step order | Arrange the order of your script by dragging the step to a different location, using the grab handle . |
Modify the step level |
Each step is assigned a level number between 1-3 at recording time (indicated by bars). Lower numbers represent higher levels, for example, a level 1 step is necessary to the business process; a level 3 step has no apparent effect on the application. Use the Step Level selector in the Step Editor to modify the level for the step. Note: You can filter the steps displayed during replay by their level using the Script Level selector in the menu bar. For more information, see Modify and view script and step levels. |
Replay the step | Click to replay the selected step. |
Disable or enable a step | Click to temporarily remove the step from the script without deleting it. Steps that are disabled are not replayed. |
Make step optional | In the event that the step cannot find its object, click and the script will continue without returning an error. |
Use alternative steps |
To redefine a step in alternative ways, click the icon, select the required step definition, and click Back. Alternative steps allow you to view instances in which there are multiple ways to perform the same user action in a step. For more information, see Use alternative steps. |
View or edit the step structure
Open the Step Editor, and click Step to display the step's settings.
You can view or modify the following:
UI Element | Description |
---|---|
Action |
The action that defines the step. The list of relevant actions is determined by the object roles. |
Object Timeout |
If the object does not appear before this time in seconds, the step returns an error. |
Step Timeout |
If the End Event is not reached by this time in seconds, the step returns an error. The way the script behaves when such an error occurs can be configured in the TruClient General Settings dialog box. |
Minimum Time |
The least time, in seconds, that the execution of the step will take. The value of this field can be either 0, “as recorded” or another manually set number. If the minimum time is set to 0, the step execution will end immediately after the step's end event. A minimum time value greater than 0 forces TruClient to wait the additional time (if not elapsed already) from the step's end event before moving on to the next step. TruClient records and stores the time that elapsed between the recorded actions and allows you to set the minimum time to “as recorded”. |
End Event |
TruClient defines when the End Event occurs during the first script replay on each supported browser. You can use the end event automatically identified by TruClient, or you can assign a different end event to the step. An End Event can be one of the following:
For details, see Synchronize script steps. |
View or edit step arguments
Step arguments vary for each of the step actions and roles.
Where applicable, you can use the argument dropdown to choose how the value of the argument is evaluated. Common options are:
Icon | Step Editor | Description |
---|---|---|
Plain text | Plain values. These are primitive types, such as: text, number, Boolean. | |
JavaScript | JavaScript expression to be evaluated. | |
Parameter |
The name of a parameter. The current value of the parameter is used. See Use parameters to vary arguments. |
For a list of the step arguments, see TruClient step arguments.
View or edit step objects
Open the Step Editor, and click Object to display the step's object settings.
You can view or modify the following:
Action | How to |
---|---|
Highlight an object |
To check if an object is visible in the application at any time, click . For details, see Highlight an object. |
Replace current object |
To replace the current object with a different object without replacing the step, click . For details, see Replace an object. |
Object roles | The Roles box displays functions that TruClient understands about an object. This information is read-only and is updated dynamically depending on how the object is used during recording. The list of available step actions is defined by these roles. For details, see TruClient object roles. |
Modify object name | The Name box displays a logical name for the object. This does not affect replay and can be modified to enhance readability. |
Improve object identification | The ID Method box displays the method of identifying the object:
|
Identify a target object | Use the Related Objects tool to enable TruClient to identify a target object in relation to an anchor object. For details, see Object identification. |
XPath and JavaScript Object ID Method
TruClient generates two possible XPaths, one based upon the object's property and the other based upon the object's DOM structure. Click the arrow next to the XPath edit box to select a suggested XPath for the object. You can manually modify the suggested XPath. To revert to one of the original expressions generated by TruClient, select one of the options from the dropdown again.
You can also click the Regenerate expression button and select an object. TruClient generates a new set of suggestions based on the selected object.
If TruClient can generate a suggested XPath for the object, that XPath is entered as the argument in an evalXPath function in the JavaScipt field. The evalXPath function returns an array of the objects defined by the XPath in the argument.
You can modify the suggested XPath in the argument to return a different list of objects, or you can enter a different JavaScript. For example: document.getElementById("SearchButton")
returns an element that has a DOM ID attribute of "SearchButton".
There is also a TruClient random function that returns a random item from an array. For example: random(document.getElementsByTagName("myArray"))
Note: The evalXPath and random functions are available as object identification methods only. They are not recognized in an Evaluate JavaScript code step.
View or edit step transactions
Open the Step Editor, and click Transactions to display the step's transactions.
This section enables you to create, modify, and view transactions. For more information, see Insert transactions.
Next steps: