1 Comment
Sort By
Hi pranoti,
Thank you for submitting a feature request. In LoadNinja, it is possible to generate some values at runtime and append them, for example, to a string using JavaScript validations. We can, for example, use a JS validation to access an input field on a page, and fill it with a string generated at runtime. See sample JS validation code below:
function _InputValue() { var element = document.getElementById("testInputId"); const months = ["JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"]; const code = "PRG"; var dateNow = new Date(); var year = dateNow.getFullYear(); var month = months[dateNow.getMonth()]; var day = dateNow.getDate(); var hours = dateNow.getHours(); var minutes = dateNow.getMinutes(); var seconds = dateNow.getSeconds(); var miliseconds = dateNow.getMilliseconds(); var textFieldValue = code + year + month + day + hours + minutes + seconds + miliseconds; if (element){ element.value = ""; element.value = textFieldValue; return true; } return false; } // DO NOT CHANGE BEYOND THIS POINT - return _InputValue();
This sample code is creating a unique string starting with "PRG" and contains a date generated at runtime.
See also: Documentation - JavaScript validations for more information.
Best regards,
Marcin,
Customer Care Engineer
Related Content
- 2 years ago
- 11 months ago
- 2 years ago