Enhance a script with Toolbox functions
There are a number of optional enhancements that can be added to scripts beyond the basic workflow. This task describes the enhancements and how to use them. For step details, see Toolbox.
Modify step arguments and objects by selecting the desired step and expanding the options. This expands the step and allows you to modify the objects and properties. For a detailed list of the step structure, see Toolbox.
Insert Flow Control Steps
Loops repeat selected portions of the script until certain criteria is met or for a specified number of times. To insert a loop, select Toolbox > Flow Control > For loop. For details, see Insert and modify loops.
Insert If blocks or If-else blocks and exit steps
To conditionalize a portion of the script, you can insert If or If-else blocks. To insert an If block, select Toolbox > Flow Control > If block. To add an else condition, click the Add else link next to the If step title. For more details, see TruClient step arguments.
Exit steps cause a script to exit the iteration or the entire script. These can be used with If statements to exit a script or iteration when a specified condition occurs. To insert an exit step, select Toolbox > Flow Control > Exit.
You can insert comments into your script by selecting Toolbox > Miscellaneous and dragging the Comment icon to the desired location.
A Catch error step traps an error in the immediately preceding step. If the preceding step is a group step, Catch error traps errors from the entire group.
If there is more than one Catch error step one after the other, they all apply to the step preceding the first Catch error step in the sequence.
To insert a Catch error step, select Toolbox > Flow Control > Catch Error.
The errors you can trap are:
- Object identification. The object the action is performed on cannot be found.
- Step arguments. One or more of the arguments to the preceding step is invalid. For example, the data type is wrong.
- Step Action. The user action failed. For example, a navigation step did not find the page. For an action on a UI element, this error is triggered if the object was found and the action failed anyway.
To handle the error, enter or drag steps or functions into the group action box. Click the +/- icon to show the box.
Verify that an object exists
To verify that a string or object exists in the application, you can insert a verify step:
Select Toolbox > Functions and drag the Verify icon to the desired location.
Click the object in the verify step.
Select the object you want to verify.
Insert generic steps
You can insert a generic or blank step and manually configure it. To insert a generic step do the following:
- Select Toolbox > Functions > Generic Object/Browser Action.
- Drag and drop the step to the desired location.
Expand the step, and enter the desired step properties.
Generic Object Actions perform an unspecified action on an object. Generic Browser Actions perform an unspecified action on the browser such as back, reload, and switch tabs.
Add download filters
You can add URLs to VuGen > Runtime Settings > Download Filters to either include or exclude specific URLs while replaying your script.