• Dynatrace Recorder



I need to get a specific object's return size. For example, I need to validate that an object's return size is not equal to zero. How can I do that in a Dynatrace Recorder script?


Use a Custom action and a Validate action.

Put the Custom action at the beginning of the step where the specific object will be downloaded. Use code similar to the following in the Custom action:

var getSize = new AddEventHookCommand(
"eventType": "replyReceived",
"name": "directNavigate",
"handler":"if (response.getRequest().getUrl().indexOf('') != -1){size = response.getHeader('Content-Length');alert('content size is :'+size); var size=parseInt(size);if(size>0){script.steps[0].actions[3].type ='do_not_execute';}}"


In the indexOf() function, we specify the object for which you want to capture the return size. In the sample code, the object is

Put the Validate action at the end of the step. Make sure the matching text string in the Validate action does not exist in the source of the step object.

If the object's return size equals 0, the script will fail with a Content Match error.

For more information, see the documentation: