Some cases if we need to have javascript code snippet for URL encoding in neoload, you can try the code.
var str1 = context.variableManager.getValue("variable name");
function urlencoding(str1) {
str1 = (str1 + '').toString();
return encodeURIComponent(str1)
.replace(/!/g, '%21')
.replace(/'/g, '%27')
.replace(/\(/g, '%28')
.replace(/\)/g, '%29')
.replace(/\*/g, '%2A')
.replace(/%20/g, '+');
}
var str2 = urlencoding(str1);
context.variableManager.setValue("newvariable",str2);
var str1 = context.variableManager.getValue("variable name");
function urlencoding(str1) {
str1 = (str1 + '').toString();
return encodeURIComponent(str1)
.replace(/!/g, '%21')
.replace(/'/g, '%27')
.replace(/\(/g, '%28')
.replace(/\)/g, '%29')
.replace(/\*/g, '%2A')
.replace(/%20/g, '+');
}
var str2 = urlencoding(str1);
context.variableManager.setValue("newvariable",str2);
sahi hai, Srini Bhai. Chalo kaam aa gaya dhanyawad
ReplyDelete- Regards
Karthik