Script element properties can be modified after recording using the KITE script editor.
The most common reason to edit Transaction Perspective scripts is to change the events that determine when a page (action) is completed. See KITE Completion Events for more information.
You may also need to edit a Transaction Perspective script to:
- Insert Virtual Actions or Filters to focus on specific page components. For more information see this help topic.
- Create Custom Components based on details such as timing between element downloads or response headers. For more information see this help topic.
- Alter the timing of script playback to accommodate Flash or Silverlight interaction. For more information see this help topic.
The Clipboard can be helpful when editing KITE scripts.
Using the script properties editor
When open, a script’s contents are shown in the Script Viewer in a hierarchical format. As you select each script element in the Script Viewer, its properties are shown in the Script Properties Editor pane. All properties of the script element are accessible within the Script Properties Editor.
Script element properties may be changed by selecting their data fields, displayed below their property names, and changing their values.
Definitions of each of the properties that can be modified are found in these help files:
Adding new elements with the right mouse menu
New script properties can be added to a script element. Within the Script Viewer select an element you want to edit and click the right mouse button to display options for adding available sub-elements to the selected element. Only items that are appropriate to the selected script element are available within the menu.
Adding HTTP headers to an action
To add HTTP Headers to an action:
Right-click the Navigate to or Click step and choose* Add HTTP Headers* .
The HTTP Headers item will appear in the Script Viewer.
Edit the Name and Value fields below in the Script Properties Editor.
Using variables in scripts
The Keynote Recorder allows you to use variables in many scripts where text entry is required. Variables enable you to create realistic, dynamic scripts that can simulate varied user choices and input.
Several types of variables are supported:
- Static value
- Previously saved value
- Value from list
- Virtual user data value
- Text found from page
- Date and/or time
- Random number value
- Random text value
A static value is not actually a variable, but simply a single value entered by the user.
Previously saved value
You can save a string such as a long URL and give it an identifier, then use that string in your script by calling its identifier. To use a previously-saved value, you must first save it from somewhere in the script and give it an identifier.
- Starting with an action that has text you want to save, click the Edit button next to the item.
- Select Save parameter value for re-use and give the value a name. Then click OK.
- Then, when you want to use the saved value in a different step than the one it was saved from, select Previously saved value from the drop-down list in the Type dialog box, enter the Saved value identifier , then click OK.
Value from list
You can create a list of values and optionally associate each item with a numerical weight. Each time the script runs, a randomly selected item from the list will be inserted into the field. Any weighting that has been assigned to items will affect the likelihood of it being selected.
The weight you provide for each value determines how frequently that value will be used in transaction measurements. Thus, if three values each have a weight of 1, each value will be used one-third of the time the transaction measurements are taken. If one item has a weight of 2 it will be twice as likely to be selected as an item with the default value of 1.
Virtual user data value
The Virtual Users feature enables you to create a collection of values that can be used by different agents when taking measurements. Although this feature is primarily designed to allow different agents to use different logins and passwords, it can be used for any situation when you want different agents to use different script values for text input fields.
Virtual users are created on the Script level, and you can have one set of virtual user data per script. The values are then available on the Action level for any text input field. For information about setting up virtual users for a script, see Virtual Profile Editor.
**How to decide between virtual users and value from list: **
- Use virtual user when there are a lot of values, when using values that must be used together (for example username/password), when the order of values matters, and for general “user”-related values (like username/password/email/address, etc.)
- Use value from list when there are a few values, when the values aren’t user-related (for example, half of users click on one link, half users click on another link), and when the order of values doesn’t matter.
Text found from page
This variable enables you to search for text from a page in a transaction and extract it for use in a field.
To use this variable, specify the text before and after the text you want to extract. This must include any HTML tags in the source HTML. If the criteria for finding text may occur more than once, you can specify an index (0 is the first occurrence). You can specify a length for the text string by selecting the Length check box and then specifying the number of characters. You can specify a window and frame number to search for the text (0 is the first occurrence).
Date and/or time
This variable lets you create scripts that include date and time data that is offset by the amount of time you specify from the “current” time when the script executes. The format for date and time can be specified using a set of values listed in the table below.
|%a||Abbreviated weekday name|
|%A||Full weekday name|
|%b||Abbreviated month name|
|%B||Full month name|
|%c||Date and time representation appropriate for locale|
|%d||Day of month as decimal number (01 - 31)|
|%H||Hour in 24-hour format (00 - 23)|
|%I||Hour in 12-hour format (01 - 12)|
|%j||Day of year as decimal number (001 - 366)|
|%m||Month as decimal number (01 - 12)|
|%M||Minute as decimal number (00 - 59)|
|%p||Current locale’s A.M./P.M. indicator for 12-hour clock|
|%S||Second as decimal number (00 - 59)|
|%U||Week of year as decimal number, with Sunday as first day of week (00 - 53)|
|%w||Weekday as decimal number (0 - 6; Sunday is 0)|
|%W||Week of year as decimal number, with Monday as first day of week (00 - 53)|
|%x||Date representation for current locale|
|%X||Time representation for current locale|
|%y||Year without century, as decimal number (00 - 99)|
|%Y||Year with century, as decimal number|
|%z, %Z||Time-zone name or abbreviation; no characters if time zone is unknown|
Random number value
Enter a Minimum value and a Maximum value. A random number is generated for each script run and used in place of the recorded value.
Random text value
Enter a minimum length and a maximum length. A random alpha-numeric string is generated for each script run and used in place of the recorded value.