Using JavaScript in HP LoadRunner

In this article, you are going to learn about using JavaScript in HP LoadRunner. Recently, HP had announced its latest version of HP LoadRunner 12.50. One of the important feature is LoadRunner now supports JavaScript scripting language for the Web HTTP/HTML protocol. By default, Web HTTP/HTML has C as the scripting language. If you are a Java lover, you can record or regenerate the script in JavaScript.

How to change the scripting language in HP LoadRunner?

To change the default language in HP LoadRunner, follow the below steps:

  1. Create a new Web HTTP/HTML protocol script
  2. Go to Record > Recording Options
  3. Click on Script and select Language as JavaScript as shown below
JavaScript in HP LoadRunner
JavaScript in HP LoadRunner

How to regenerate the script in JavaScript?

If you already have a script in C, you can regenerate it in JavaScript. Below are the steps to regenerate:

  1. Open the script
  2. Go to Record > Regenerate Script or press Ctrl + Shift + R
  3. Click on Options
  4. Click on Script and select Language as JavaScript
  5. Click on OK button in Regenerate Options dialog
  6. Click on OK

This will completely overwrite the script by deleting/overwriting the parameterization, correlation, and recorded actions. Please have a backup before you regenerate the script.

Below is the sample request in JavaScript. In subsequent posts, I will post about important JavaScript functions.

name : ‘search’,
url : ‘’,
resource : 0,
recContentType : ‘text/html’,
referer : ”,
snapshot : ‘t2.inf’,
mode : ‘HTML’,

If you like my article, please do share in your favorite social media. Please do not forget to subscribe to my weekly newsletter, it is FREE.

JavaScript in HP LoadRunner

2 thoughts on “Using JavaScript in HP LoadRunner”

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Learn Apache JMeter for free. No Strings Attached.Watch Now for FREE
+ +
Share via
Copy link