In addition to the usual configuration in the UI, you can use Script mode to configure your clickpath or single-URL monitors. In this mode, you can access the underlying JSON script of your monitor. If you're a synthetic power user, this will make your life a lot easier and allow you to speed up clickpath creation and management. Use the script editor to quickly find specific events (steps), adapt locators across the whole script, or edit parts of the clickpath without rerecording.
You aren't limited to just one mode—you can switch back and forth between the UI and script modes by clicking the Clickpath/Script switch.
To edit your clickpath browser monitor in script mode:
To edit your single-URL browser monitor in the script mode:
You can download the script (Download script as .json) or just copy it from the editor and edit it in a text editor of your choice. However, you can also edit the script directly in the browser. This provides the following benefits:
Note that you need to escape all special characters and break lines with a backslash (for example, a new line is \n
, double quotes is \"
, and tab is \t
).
You can play your changes back for clickpath scripts without saving them—just click Play back clickpath.
Contains the monitor script.
Element
Type
Description
Required
type
string
The type of monitor
Possible values are:
clickpath
for clickpath monitorsavailability
for single-URL browser monitorsnavigate
type.required
version
string
Script version—use the 1.0
value here.
required
events
Steps of the clickpath—the first step must always be of the navigate
type.
Note that an event is not the same thing as an action—only events that trigger web requests are called actions, so your script might not have as many actions as events. Synthetic actions (similar to user actions for real user monitoring) hold the performance data collected during the playback of clickpath events.
The actual JSON object of the event depends on its type:
navigateEvent
—contains a Navigate event.interactionEvent
—contains a Click or Tap event.javaScriptEvent
—contains a JavaScript event.selectOptionEvent
—contains a Select option event.cookieEvent
—contains a Cookie event.keystrokesEvent
—contains a Keystroke event.required
ScriptConfig
object Contains the setup of the monitor.
Element
Type
Description
Required
device
The emulated device of the monitor—holds either the parameters of the custom device or the name and orientation of the preconfigured device.
If not set, then the Desktop
preconfigured device is used.
optional
bandwidth
The emulated network conditions of the monitor
If not set, then the full available bandwidth is used.
optional
requestHeaders
The list of HTTP headers to be sent with requests of the monitor
optional
cookies
List of cookies to be created for the monitor
These cookies are added before execution of the first step.
optional
customDevice
object Contains the emulated device of the monitor.
Element
Type
Description
Required
mobile
boolean
The flag of the mobile device
Set to true
for mobile devices or false
for a desktop or laptop.
required
touchEnabled
boolean
The flag of the touchscreen
Set to true
if the device uses touchscreen. In that case, use can set interaction event as tap
.
required
width
integer
The width of the screen in pixels
The maximum allowed width is 1920
.
required
height
integer
The height of the screen in pixels
The maximum allowed height is 1080
.
required
scaleFactor
integer
The pixel ratio of the device
optional
predefinedDevice
object Contains one of the preconfigured device emulations.
Element
Type
Description
Required
deviceName
string
The name of the preconfigured device—when editing in the browser, press Crtl
+Spacebar
to see the list of available devices.
required
orientation
string
The orientation of the device—portrait
or landscape
Desktop and laptop devices are not allowed to use the portrait
orientation.
required
bandwidthOptions
object Contains the emulated network conditions of the monitor.
Element
Type
Description
Required
latency
integer
The latency of the network, in milliseconds
required
download
integer
The download speed of the network, in bytes per second
required
upload
integer
The upload speed of the network, in bytes per second
required
predefinedBandwidth
object Contains the pre-configured network emulations.
Element
Type
Description
Required
networkType
string
The type of the preconfigured network—when editing in the browser, press Crtl
+Spacebar
to see the list of available networks.
required
requestHeader
object Contains the list of HTTP headers to be sent with requests of the monitor.
The following headers are not allowed:
Element
Type
Description
Required
name
string
The name of the HTTP header
required
value
string
The value of the HTTP header
required
requestCookie
object Contains the list of cookies to be created for the monitor.
Every cookie must be unique within the list. However, you can use the same cookie again in other event.
Element
Type
Description
Required
name
string
The name of the cookie
The following cookie names are not allowed:
dtCookie
dtLatC
dtPC
rxVisitor
rxlatency
rxpc
rxsession
rxvt
required
value
string
The value of the cookie—the following symbols are not allowed: ;,\"
.
required
domain
string
The domain of the cookie
required
path
string
The path to the cookie
optional
navigateEvent
object Contains a Navigate event.
Element
Type
Description
Required
type
string
The type of synthetic event
In this case, the event type is navigate
.
required
url
string
The URL to navigate to
required
description
string
A short description of the event to appear in the UI
required
wait
The wait condition for the event—defines how long Dynatrace should wait before the next action is executed.
optional
validate
The validation rule for the event—helps you verify that your browser monitor loads the expected page content or page element.
optional
interactionEvent
object Contains a Click or a Tap event.
Element
Type
Description
Required
type
string
The type of synthetic event
In this case, click
or tap
required
description
string
A short description of the event to appear in the UI
required
button
integer
The mouse button to be used for the click
required
wait
The wait condition for the event—defines how long Dynatrace should wait before the next action is executed.
optional
validate
The validation rule for the event—helps you verify that your browser monitor loads the expected page content or page element.
optional
javaScriptEvent
object Contains a JavaScript event.
Element
Type
Description
Required
type
string
The type of synthetic event
In this case, javascript
required
description
string
A short description of the event to appear in the UI
required
javaScript
string
The JavaScript code to be executed in this event
required
wait
The wait condition for the event—defines how long Dynatrace should wait before the next action is executed.
optional
selectOptionEvent
object Contains a Select option event.
Element
Type
Description
Required
type
string
The type of synthetic event
In this case, selectOption
required
description
string
A short description of the event to appear in the UI
required
wait
The wait condition for the event—defines how long Dynatrace should wait before the next action is executed.
optional
validate
The validation rule for the event—helps you to verify that your browser monitor loads the expected page content or page element.
optional
cookieEvent
object Contains a Cookie event.
Element
Type
Description
Required
type
string
cookie
required
description
string
A short description of the event to appear in the UI
required
cookies
The list of cookies to be created during the event
Every cookie must be unique within the list. However, you can use the same cookie again in other event.
required
keystrokesEvent
object Contains a Keystroke event.
Element
Type
Description
Required
type
string
keystrokes
required
description
string
A short description of the event to appear in the UI
required
textValue
string
The text to enter
required
masked
boolean
Indicates whether the textValue is encrypted (true
) or not (false
).
required
simulateBlurEvent
boolean
Defines whether to blur the text field when it loses focus.
Set to true
to trigger the blur the textValue
.
required
wait
The wait condition for the event—defines how long Dynatrace should wait before the next action is executed.
optional
validate
The validation rule for the event—helps you to verify that your browser monitor loads the expected page content or page element.
optional
waitCondition
object Contains the wait condition for an event.
Element
Type
Description
Required
waitFor
string
The time to wait before the next event is triggered
Possible values are:
page_complete
—wait for the page to load completely.network
—wait for background network activity to complete.next_action
—wait for the next action.time
—wait for specific period of time.validation
—wait for a specific element to appear.required
milliseconds
integer
The time to wait, in milliseconds
The maximum allowed value is 60000
.
required for the time
type
Not applicable otherwise
timeoutInMilliseconds
integer
The maximum amount of time to wait for a certain element to appear, in milliseconds—if exceeded, the action is marked as failed.
The maximum allowed value is 60000
.
required for the validation
type
Not applicable otherwise
validation
The element to wait for
required for the validation
type
Not applicable otherwise
validationType
object Contains the validation rule for an event or waiting rule.
Element
Type
Description
Required
type
string
The goal of the validation:
content_match
—check page for the specific content. Not allowed for validation inside of wait condition.element_match
—check page for the specific element.required
match
string
The content to look for on the page
Regular expressions are allowed. In that case set isRegex as true
.
required for content_match
optional for element_match
isRegex
boolean
Defines whether match is a plain text (false
) or regular expression (true
).
optional
failIfFound
boolean
The condition of the validation:
false
—validation succeeds if the specified content/element is found.true
—validation fails if the specified content/element is found.required
target
The element to look for on the page
required for element_match
optional for content_match
authenticationType
object The login credentials to bypass the browser login mask during a Navigate event
Element
Type
Description
Required
type
string
The type of authentication—basic
or webform
.
Only the basic
type is allowed in clickpath monitors.
optional
username
string
The username to log in with
required
password
string
The password to log in with
It contains not the actual password, but a unique ID of it, and the password itself is stored in Dynatrace and found by the ID. If you change the ID, the stored password becomes unavailable.
To change the password, set the masked property as false
and type in the new password.
required
masked
boolean
The flag of the masked password
true
means that the password is encrypted and stored, and the password field shows the ID of the password to encrypt the password.
Set false
to type in a new password.
optional
listOptions
object Contains the options to be selected in the Select option event.
Element
Type
Description
Required
index
integer
The index of the option to be selected
required
value
string
The value of the option to be selected
required
targetType
object Contains the target tab or element of the event.
Element
Type
Description
Required
window
string
The tab of the target
optional
locatorType
object Contains an element of a page to look for.
Element
Type
Description
Required
type
string
Defines where to look for the element:
css
—in CSS selectordom
—in JavaScript coderequired
value
string
The name of the element to be found
required
This is a model of the script JSON, showing all the possible elements. It has to be adjusted to be used as an actual script. To get an example of a real monitor, you can check the script of an existing monitor.
{"configuration": {"userAgent": "string","device": {"mobile": true,"touchEnabled": true,"width": 375,"height": 667,"scaleFactor": 2,"deviceName": "string","orientation": "portrait"},"bandwidth": {"latency": 1,"download": 1,"upload": 1,"networkType": "WiFi"},"requestHeaders": {"addHeaders": [{"name": "string","value": "string"}],"toRequests": ["string"]},"cookies": [{"name": "string","value": "string","domain": "string","path": "string"}]},"version": "1.0","type": "clickpath","events": [{"type": "navigate","url": "string","description": "string","wait": {"waitFor": "page_complete"},"authentication": {"type": "basic","masked": true,"username": "string","password": "string"},"validate": [{"type": "content_match","failIfFound": true,"isRegex": false,"match": "string"}],"target": {"window": "string"}},{"type": "click","description": "string","button": 0,"wait": {"waitFor": "network"},"target": {"locators": [{"type": "css","value": "string"},{"type": "dom","value": "string"}]},"validate": [{"type": "element_match","failIfFound": false,"target": {"locators": [{"type": "css","value": "string"}]}}]},{"type": "javascript","description": "string","javaScript": "string","wait": {"waitFor": "time","milliseconds": 2000},"target": {"window": "string"}},{"type": "selectOption","description": "string","selections": [{"index": 1,"value": "string"}],"wait": {"waitFor": "validation","validation": {"type": "element_match","failIfFound": false,"match": "string","target": {"locators": [{"type": "dom","value": "string"}]}},"timeoutInMilliseconds": 60000}},{"type": "cookie","description": "string","cookies": [{"name": "string","value": "string","domain": "string","path": "string"}]},{"type": "keystrokes","description": "string","textValue": "string","masked": false,"simulateBlurEvent": true,"wait": {"waitFor": "next_action"}}]}