Unanswered question

Unable to use Javascript in Neoload?

I need to convert the below value into a valid URL

when I use the functions in neoload javascript using hardcoded value I get the correct value but when I use the extracted parameter which has similar value it gives me a different output.

var myVar = encodeURIComponent("\x2fsap\x2fbc\x2fwebdynpro\x2fsap\");
var uri_dec = decodeURIComponent(myVar);

context.variableManager.setValue("URL2", uri_dec);

Output : URL2=/sap/bc/webdynpro/sap/

URL_HTML1 is the extracted parameter
Value in URL_HTML1=\x2fsap\x2fbc\x2fwebdynpro\x2fsap\

var myVar1 = encodeURIComponent(URL_HTML1);
var uri_dec1 = decodeURIComponent(myVar1);
context.variableManager.setValue("URL3", uri_dec1);

Output: URL3=\x2fsap\x2fbc\x2fwebdynpro\x2fsap\

Rishabh W.
Rishabh W.

Rishabh W.

35 / 100


May Be the value you are extracting is encoded in another format before you beginned to decode it.
When you extract value from response in Neoload, there is a check box below on the left in extract value dialog box. Try to play with. You might be able to get your value in the the right format.

I'm not familiar with the encode/decode functions you are using but as these are strings, can you not use the replace function?

var url_path = "\x2fsap\x2fbc\x2fwebdynpro\x2fsap\";
var url_path_clean = url_path.toString().replace("\x2f","/");

I've not tested this but the syntax should be close