Share this page

# 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.

In this topic:

## 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: Automatic: Not Yet Set. The automatic end event has not yet been determined. Automatic: Timers Ended. The automatic end event whenever TruClient identifies either the `setTimeout()` or the `setInterval()` function running as part of the document load in the JavaScript code. Note: This feature has been deprecated. It is supported for TruClient scripts recorded in older versions, but not for new scripts. Action Completed. Step ends when its action is completed. An example of an action is a button click. DOM content loaded. Step ends when the page's Document Object Model (DOM) is ready. This means that the API for interacting with the content, style, and structure of a page is ready to receive requests from your application's client side code. Step synchronous network completed. Step ends when all HTTP requests have been completed excluding requests that are associated with open connections that are not relevant to the step. Usually, these requests are triggered by using XMLHttpRequest. Document Loaded. Step ends when the process of loading a document is completed. This means that all scripts and stylesheets have finished loading and have been executed, and all images have been downloaded and displayed. Object Exists. Step ends when the end event object is visible on the screen. For TruClient Web and TruClient Mobile Web scripts, this end event must be selected manually in the step. For TruClient Native Mobile scripts, this end event is automatically identified during the first replay. For more information, see Enhance TruClient - Native Mobile scripts. Note: There is no distinct timeout for the object selected in the End Event field; the timeout is based on the Step Timeout value. For details, see Step Timeout. Step network completed. Step ends when all HTTP requests have completed including requests initiated by XMLHttpRequest. Dialog opened. Step ends when a dialog box is opened. 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: Automatic. TruClient's default object identification method. If this method does not successfully find the object during replay, click the Improve Object Identification button, reselect the correct object from the application, and replay the script again. XPath. Identifies the object based on its XPath expression that defines the object in the DOM tree. When you select this option, the next edit box in the display is labeled XPath and enables you to select an XPath to define the object. See XPath and JavaScript Object ID Method for details. Note: If the object to identify is encapsulated in a web component, and you want to change the XPath expression, we recommend you do not manually modify it. Instead, click to generate a new XPath expression. JavaScript. JavaScript code that returns an object. When you select this option, the next edit box in the display is labeled JavaScript and enables you to write JavaScript to define the object. For details, see XPath and JavaScript Object ID Method or Work with JavaScript in TruClient scripts. Descriptors. Enable you to identify an object by its properties in an editor. For details, see Descriptors.
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

- End events
- Synchronize script steps
- Record a TruClient script
- Replay a TruClient script
- Enhance a TruClient script

https://admhelp.microfocus.com VuGen,Professional Performance Engineering,Performance Engineering for Developers 8942
Tips to improve your search results... OpenText™ Virtual User Generator Help Center OpenText™ VuGen Help 26.1-26.3 All View Local Help Center View Online Help Center Version: