Dynatrace Synthetic Scripting capabilities

Hello everyone.

Need to automatically apply current date to a date field each time my web transaction is re-played. Shown below is the code from dynatrace synthetic script.

I added the following "var date = (today.getMonth()+1)+‘-’+today.getDate()+‘-’+today.getFullYear() to the TextValue field.

Each time web transaction is replayed, the date field is not displaying the current date. I only see the text from the code.

Any help would be greatly appreciated.

I am new to json coding but I am eager to learn!

Thank You!

}, {

“type”: “keystrokes”,

“target”: {

“locators”: [{

“type”: “css”,

“value”: “input[name=\“dos\”]”

}, {

“type”: “dom”,

“value”: “document.forms[\“Form1\”][9]”

}, {

“type”: “css”,

“value”: “.form-control:eq(2)”

}, {

“type”: “css”,

“value”: “#Form1 div:nth-child(5) div:nth-child(2) div:nth-child(2) div:nth-child(3) div:nth-child(2) input”

}, {

“type”: “css”,

“value”: “#Form1 div.panel div.panel-body div.form-horizontal div.form-group div.col-sm-8 input.form-control:eq(0)”

}]

},

“masked”: false,

“simulateBlurEvent”: true,

“description”: “keystrokes on \“dos\””,

“textValue”: “var date = (today.getMonth()+1)+‘-’+today.getDate()+‘-’+today.getFullYear()”

}, {

{

“type”: “javascript”,

“wait”: {

“waitFor”: “time”,

“milliseconds”: 2000

},

“description”: “Current_date”,

“javaScript”: “var rightnow = new Date();\nvar date = \”\" + (rightnow.getMonth()+1) + \“/\” + rightnow.getDate() + \“/\” + rightnow.getFullYear();\napi.setValue(‘date’, date);"

},

Hi Richard,

do you still need help with this? If yes, is the web application you are scripting against public? You should be able to achieve this with a JavaScript event. See https://www.dynatrace.com/support/help/how-to-use-dynatrace/synthetic-monitoring/browser-monitors/browser-clickpath-events/#javascript-

Kind regards,
Philipp