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.
Table of Contents
How to change the scripting language in HP LoadRunner?
To change the default language in HP LoadRunner, follow the below steps:
- Create a new Web HTTP/HTML protocol script
- Go to Record > Recording Options
- Click on Script and select Language as JavaScript as shown below
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:
- Open the script
- Go to Record > Regenerate Script or press Ctrl + Shift + R
- Click on Options
- Click on Script and select Language as JavaScript
- Click on OK button in Regenerate Options dialog
- 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.
web.url(
{
name :Â ‘search’,
url :Â ‘http://www.bing.com/search?q=QAInsights’,
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.
Hi Naveen
Today i visited your site first time but found very inetersted blogs i m keen to learn php with java script but always get confused about code of both
It will be ideal to learn both.