Monday, February 20, 2023

Encode a value from HTML to URL format using JavaScript

LoadRunner Web HTTP/HTML Protocol has a function "web_convert_param()" that can encode values from HTML to URL format, however this function isn't work as expected.

Example: In this case, I'm looking to encode the following string "670523 X" from HTML to URL format.

In reality, the needed value is 670523%20X, but the output is "670523+X".
As a workaround for the above challenge, I have written custom JavaScript to encode the string into URL format, we will use this custom code in the "web_js_run" function.

Resolution:

Output: Encoded string to URL format = 670523%20X

Example:


Output: Encoded string to URL format = abshabhdgyuagdyuaduijbdauduiada0%40%401kdnfkdskfnsd%23%23%24%24%25ksksnk12345


Git Hub: web_js_run

YouTube: Coming Soon

No comments:

Post a Comment

Generate a dynamic Transaction Name that starts with the script name, transaction number, and transaction description

Problem Statement: Every start and end transaction in the script should have a name in the format "ScriptNo_AppName_ModuleName_Transact...