cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

adding timestamp to textvalue in browser clickpath Synthetic Monitors

sreevanama
Newcomer_

Hi  All - we need to generate a reconcilation report everyday.

for ex: App --> create recon report --> "Myreconreportname" . so , i have created a Synthetic check to record the session.

for the first attempt, when i do "record Clickpath" it was successful, when i schedule this synthetic check to run every 1 day, Synthetic check got failed saying "Myreconreportname" already exist.

Script i see in the synthetic recorder is:
"description": " keystrokes on \"txtReconReportName\"",

"textvalue":"Myreconreportname"

 

i want to add timestamp along with Myreconreportname so that my synthetic check will succeed everyday.

 

Appreciate if i can get some solution to this

4 REPLIES 4

HannahM
Dynatrace Leader
Dynatrace Leader

You will need to use a JavaScript event to generate the report name. 

var todayDate = new Date();
var reportName = "Myreconreportname" + todayDate;
api.setValue("reportName", reportName);

you can then use the placeholder {reportName} for the Keystroke value

HannahM_0-1718725687577.png

 

Synthetic SME and community advocate.

Hi @HannahM  - Thanks for the reply,

Where can i use the sample script shared by you? 

var todayDate = new Date();
var reportName = "Myreconreportname" + todayDate;
api.setValue("reportName", reportName);

 

My Code is looks like below:

 

{ "Type" : "keystrokes",

    "target": {

                      "locators": [{

                                  "type": "css",

                                  "value": "#txtReconReportName"

                               },{

                                   "type": "css",

                                  "value": ".form-control:eq(0)"

                              },{

                               "type": "css",

                               "value": "#txtReconReportName"

                              },{

                               "type": "css",

                               "value": "input[type=\"text\"][id=\"txtReconReportName"]"

}]

},

"masked" : false,

"SimulateBlurEvent" : true,

"description":"Keystroke on \#txtReconReportName\""

"textvalue": "{ReportName}" -- Placeholder as suggested by you

sreevanama_0-1718805660780.png

 

The snippet should go in a new JavaScript event which you add prior to the Keystrokes event. 

Synthetic SME and community advocate.

Thanks @HannahM  it worked.

Featured Posts