Information:

Environment

  • Dynatrace Recorder

 

Symptoms

Can I add conditional custom code such as "If-Else" logic to control a script behavior?

Solution

You can use a Custom action to add JavaScript to a script to handle conditional actions.

The following code is an example of the JavaScript you can use.

//Note: this code snippet should be added into a "control" window
if (element.innerHTML.indexOf('compuware') == -1){ // If a specified condition is true
script.steps[1].actions[1].type ='do_not_execute'; // Then execute/ don't execute some actions
}

For more information about using custom code, see the help pages: