JavaScript Support


You can include the execution of a JavaScript code into virtual user profiles. There are two ways to do that.

1. First, you can create and use a library of JavaScript functions. They can be stored in multiple files located either on local disc or on the Web. In the latter case you can specify them by a set of URLs. These functions can be used same way as other WAPT Pro functions to assign values to variables and parameters of any request.

2. Second way is to use a new type of operator that executes JavaScript code. It can be added to any place of a profile where operators are allowed.

In both cases your code can use the following external objects:

The recently received web site response in form of HTML DOM structure or as a raw text consisting of the header and body. This object is available only for reading.

All WAPT Pro internal variables. You can read their values and set them. In fact, assigning values to the variables is the only allowed way to provide output from the code. These variables can be used in the subsequent requests.

Log object. You can write messages to it. They will be displayed in the WAPT Pro log viewer along with the other saved data.

The possibility to use JavaScript code provides you with a universal way to perform any specific and complex calculations required to set the correct values of the request parameters. Now you are not limited to a set of predefined functions that were only available for this purpose before. You can even take JavaScript code from your web pages and insert it into your profiles. You will only need to modify it, so that it would assign the result of its work to variables that will be used in subsequent requests as their parameters.

Next page