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

How can i add content validation for multiple "contains validation text" in Dynatrace synthetic browser monitor?

aniketromit19
Visitor

I have configured few browser monitoring for which i want to create a content validation if multiple "Queued" status is shown in page. This will tell me if there are more than one job that is queued. Is there a way to do this?

4 REPLIES 4

HannahM
Dynatrace Champion
Dynatrace Champion

Yes, you can use a JavaScript event to vaidate the value of multiple jobs

Hi Hannah,

 

I have tried the below snippet in order to check if there are "Queued" status but it doesnt work. I need your suggestion on how to check for multiple of same string and alert should fire if the count of string is greater than 5.

 

//Check status of the queued jobs
// If the status is queued for more than 4 jobs, fail monitor

text = 'Queued'

text1 = scheduledReports.innerText;
api.info(text1);
if (text1.indexOf(text) > -1) {
api.fail('Reports are in queued status');

}

Does .match().length do what you want?

//Check status of the queued jobs
// If the status is queued for more than 4 jobs, fail monitor

text = 'Queued'

text1 = scheduledReports.innerText;
api.info(text1);
if (text1.match(text).length > 4) {
api.fail('Reports are in queued status');

}

Hey Hannah,

Thanks for your response. I did try using the "text1.match(text).length > 4" but it shows "Your last playback was successful" even when there were 5 queued jobs.

 

Is there anything i am missing here?

 

Thanks