Web Recorder actions

The actions that are recorded in Web Recorder transactions are described below.

The Navigate action displays the web page for the specified URL. It is automatically created as the first action in a transaction. You can create a Navigate action while recording a transaction by entering a URL (including any required parameters) in the browser's address bar to go to a new page.

Going to a new web page by clicking a link in the current web page creates a Click action in desktop transactions (or in Mobile transactions, a Tap action), not a Navigate action.

After recording a transaction, you can add a Navigate action to the timeline:

  1. Click the plus sign   in the timeline where you want to add the Navigate action.
  2. Click Navigate in the Insert New Action window.
    The Navigate editing screen appears.
  3. Configure the action. Entering a URL is required.
  4. Optional, but recommended: Add wait time to the action as described below. Usually a Wait action is required after a Navigate action to provide time for the page to load completely.
  5. Optional: Add validation to the action as described below.
  6. Click Save.
  7. Click Back to Transaction at the top of the editing screen.

Click

In browser scripts, the Click action defines where on a page to record a mouse click. It is inserted when you click an element such as a link, button, or field.

If the transaction will require a cookie with the same value for every test run, you can insert a Cookie action to provide that value at the appropriate point in the transaction.

A cookie that's downloaded while you're recording the transaction is recorded, but doesn't create a Cookie action in the timeline.

Example: Your website may deliver content specifically for first-time visitors. In that first visit, a cookie is downloaded so the visitor is identified in future visits as a return visitor and the "first-time" content is not displayed. Dynatrace Synthetic tests, however, clear the browser cache and delete cookies before each test run; every test run is a "first-time visitor". To make the test simulate return visitors, you can add a Cookie action to the transaction to identify each test run as a return visit.

To add a Cookie action:

  1. Click the plus sign   in the timeline where you want to add the Cookie action.
  2. Select Cookie from the Insert New Action list.
    The Cookie editing screen appears.
  3. Define the Cookie Name and Cookie Value.
  4. Optional: Enter the URL for the cookie.
  5. Click Save.
  6. Click Back to Transaction at the top of the page to close the Cookie detail page.

You can use a Cookie action to remove a cookie that was set earlier in the transaction, either inserted as a Cookie action or downloaded when you recorded the transaction. Insert a Cookie action at the appropriate point in the transaction, specifying the Cookie Name and (if required) the URL, but leaving the Cookie Value blank.

File

Many websites include features for uploading files; for example, adding images to a photo sharing site or attaching documents to an email message. When you upload a file while recording a transaction, the file value, with appropriate locators, is added to the script. The actual file data is not stored in the script, to minimize data storage requirements. To simulate the file upload, you must edit the File action to provide the URL to a sample file. The file must be hosted somewhere on the web where the Dynatrace test locations can access it. This URL will be downloaded by the agent during playback and then used for uploading when the File action is executed.

If you upload a file while recording a transaction, a File action is not automatically added. After recording a transaction, you can add a File action at the appropriate position in the timeline.

  1. Click the plus sign   in the timeline where you want to add File action.
  2. Select File from the Insert New Action list.
    The File Upload editing screen appears.
  3. Enter the URL of the sample file in the URL field near the bottom of the editing screen.
    As you type the URL, it is automatically added to the Action Name.
  4. The other settings are optional.
    • Wait time – See Wait, below.
    • Validate page content – See Validation, below.
    • Target – Expand Advanced Options for the target window.
    • Locators – Expand Advanced Options to add locators.
  5. Click Save at the bottom of the editing screen.
  6. Click Back to Transaction at the top of the screen.

This action is not supported for playback in the Web Recorder; it is only executed when the test runs.

Filter

Use the Filter action to exclude objects such as domains, scripts, and third-party resources from your script results because they do not reflect what you want to measure. Define the filter criteria to prevent the download of any objects that match the criteria.

You can use Filter actions to both turn on and turn off filtering. Insert a Filter action at the point in the timeline where you want to start filtering, and another Filter action at the point where you want to stop.

Click the plus sign   in the timeline where you want to add the action.

Enter a name in the Filter Name field, for example to identify the type of object being filtered.

To leave the action enabled, skip the Turn Filter Off control.

Click Add Filter Target to define the Filter text and specify whether to filter objects with a name that Begins with or Ends with the text or Contains the text anywhere in the name.

For example:

  • To filter all objects from a third-party domain, specify the URL of that domain.
  • To filter images, add targets for objects ending in gif, jpg, etc.

Click Save New Filter Target to add the target to the filter.
Repeat this step until you've added all required filters.

Optionally, select Fail if this text is located in this action to use the filter to test for page errors. In this use case, specify any part of an error message as the filter text.

Add wait time and validation if needed, as described below.

Click Save.

Turn off filtering

To stop filtering before the end of the test, insert another Filter action to cancel the previous action.

  1. Add the Filter action in the timeline at the point where you want to stop filtering.

  2. Use the same name as the Filter action you want to cancel out.

  3. Click Turn Filter Off.

  4. Skip the Filter Target and the wait and validate attributes.

  5. Click Save.

HTTP

Use the HTTP action to add specific HTTP requests to a step in your script: GET, POST, PUT, DELETE, or HEAD method to a step.

You can use this action to create transactions for web services requests made by a plug-in.

You must add the HTTP action manually to a transaction; it's not created automatically during recording.

  1. Click the plus sign   in the timeline where you want to add the action.
  2. Click HTTP Request in the Insert New Action window to open the editing screen.

Configure one or more HTTP Requests:

Select the request Type from the list.

Enter the URL.

To add a header or reply handler specific to this request, click More to display the settings. You can also add a post body to POST, DELETE, and PUT requests.

  • Header – The Edit Headers tab is selected by default. Click Add Header, then enter the Header Name and Header Value. Repeat as needed, then click Apply Changes.

  • Reply Handler – Click Edit Reply Handler to display the reply handler code. Uncomment the second line, alert('response='+JSON.stringify(response));, then click Apply Changes.
    After playback, the response content will be displayed in the action's editing screen.
    Note: After you play back an HTTP transaction, you can display the output through the [View HTTP Request/Response Results]({% link_to_id id-reviewing-and-editing-a-transaction%}#anchor_httpresults) link in the Advanced section of the Script Options. You don't need to enable the reply handler in the action to use this option.

  • Post Body – Click Edit Post Body to display an editing field. Enter the body content, then click Apply Changes. This text is stored using Base 64 encoding in the script; click View As Base64 to see the encoded string.

You can also define headers to be applied to all requests, in the Headers section below the HTTP Requests section.

By default, the action is configured to wait for background network activity to complete.

Best practice is to add a validation.

You can create web services tests that consist of HTTP actions with Script actions for JavaScript that supports the HTTP requests.

The Web Recorder doesn't currently support manually opening the transaction editor, so to display the editor, begin as if you were recording a transaction. It doesn't matter what URL you enter to launch the Web Recorder. After you configure the web services test, you can delete the initial Navigation action before playback if it isn't necessary to the test. Best practice is to disable the Navigate action while you're editing, then delete the Navigate action when you're satisfied that the transaction is correct.

To reference the correct step/action number for the HTTP action in the JavaScript, enable Show Script Hints in the script settings. This option displays the array item in the GSL script for that action, which will not be the same as the Step/Action labels in the transaction editor.

Keystrokes

The Keystrokes action captures the string you type in a field on the web page.

When you record a Mobile transaction, tap or click in a text field to display an onscreen keyboard so you can simulate tapping the characters on a mobile device. You can tap the keyboard on a touch-enabled screen, or use the mouse cursor to select keys on any screen.

The string is recorded in the Text Value field. This field can be edited.

When you type text in a masked field (e.g. a password), the Text Value field is automatically encrypted. You can also manually encrypt the text. When you click the lock icon below the field to encrypt the content, the text in the field is replaced by a row of dots. You can't undo the encryption. If you click the lock icon to "unlock" the field, the content is deleted.

Script

Use a Script action to add JavaScript code to the transaction to handle programmed features of your website.

Add this action after you finish recording the transaction:

  1. Click the plus sign   in the timeline where you want to add the action.

  2. Click Custom JavaScript in the Insert New Action window to open the editing screen.

  3. Configure the action.

    1. Target

      • To use the default target window, gomez_top[0], keep this default setting. The window definition can be edited, for example to open a web page into a new window gomez_top[1].
      • To define the target window as control, select Advanced script. This window definition can't be edited. For more information, see Executing JavaScript Within the Control Scope.
    2. Code – Type the JavaScript in the editing field.
      The editor automatically color-codes JavaScript syntax, and highlights syntax errors. However, it doesn't validate that the code will execute successfully.

    3. Wait time – Optional: Add wait time to the action as described below.

    4. Validate page content – Optional: add validation to the action as described below.

  4. Click Save at the bottom of the editing screen.

  5. Click Back to Transaction at the top of the screen.

The Script action is similar to the Custom action in the Windows Recorder. For more information, see the Custom Scripting section of the Advanced Scripting Guide for the Windows Recorder.

Select

The Select action describes the use of drop-down lists in a script. This action is added when you use keystrokes to select a list item — e.g. using cursor keys to move up or down the list and the Enter key to make the selection — instead of clicking on the list item.

Rotate

In Mobile transactions, the Rotate action simulates changing the orientation of a mobile device from portrait to landscape or vice versa. This action is not available for browser tests (Backbone, Last Mile, Private Last Mile).

To insert a Rotate action while recording:

  1. Click the Web Recorder icon at the right side of the recording window's address bar.
  2. Click the arrow for the Orientation list, and select the direction to rotate: Clockwise or Counterclockwise.

    The device screen in the recording window changes its orientation.

Tap

In Mobile transactions, the Tap action defines where on a page to record tapping a mobile device screen with a fingertip. For example, a Tap is inserted in the transaction when you tap a hyperlink or button, or tap to select a field.

A Tap action is created in Mobile transactions, even if you are recording on a machine that is not touch-enabled. In the recording window, the cursor changes to an icon that represents a fingertip: .

Validation and wait

Validation

You can define a validation for each Web Recorder action. You specify the content that the agent must find (or in the negative case, must not find) on the page before it can continue processing the script. If a match is not found (or, in the negative case, is found), the agent reports a failure and flags it as a Content Match Error, and execution stops at that action.

At the least, you should add a validation for the final action in a step, to confirm that the page loaded completely and performed correctly.

Wait

The Wait setting for an action defines how long the Web Recorder should wait after playing back the action:

  • Wait for the page to load completely.
  • Wait for background network activity to complete.
  • Wait for a specific period of time. If you select this option, use the field that appears below the Wait setting to specify the number of milliseconds to wait.
  • Wait for a specific element to appear. For this wait type, specify the Match text that identifies the object and the Target window if different from the default, and define Locators as needed.
  • Wait for a page event. Select DOMReady or Load for the event, and define the Target window if different from the default.

If the action has a default Wait setting, you can change it to a different wait type. You can add more than one wait to an action; for example, so the test waits for the page to load and then waits for a specified time before beginning the next action.

For more information, see Waits and timeouts.