HTML parser for managing resources

The DevWeb HTML parser enables the handling of HTML body resources during script generation and in replay.

Note: This functionality can be configured in the DevWeb YAML files on all LoadRunner tools running DevWeb tests.

About managing HTML resources

Your script code can become hard to read when it contains information about hundreds of resources related to the main web request. Using the HTML parser, you can manage this information, reducing the noise and complexity in your scripts.

The parser can be utilized in the following ways:

  • During script generation. You can filter the resources found in HTML body, from the web request step resources list displayed in the script.

  • During replay. You can decide whether these resources should be downloaded at runtime.

Manage resources during code generation

The Offline Script Generator handles the HTML body resource settings, before writing the script.

To manage resources during code generation:

  1. Open <DevWeb root folder>\generator_config.yml.

  2. Expand the filter section.

  3. In the showResources key, define the value to include the required web request resources in the scripts:

    Value Description
    all All resources are displayed (default).
    dynamic

    Only non-HTML body resources are displayed. This means that resources that were not discovered in HTML will be presented in the script.

    none None of the resources are displayed.
  4. Save your changes.

Back to top

Manage resources during replay

To enable the HTML parser to find and download HTML resources during replay, add the property downloadHtmlStaticResources into the WebRequests in the script, and set it to true.

For example:

Copy code
const webResponse2 = new load.WebRequest({
    id: 2,
    url: https://www.somecompany.com,
    method: "GET",
    downloadHtmlStaticResources: true,
    headers: {
        "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
    },
}).sendSync();

Tip: You can set a value for all the web requests in your script, without repeating the code every time, by adding the downloadHtmlStaticResources property to the defaults in the initialize section of the script. You can then set it to true or false, as you want.

For example:

load.WebRequest.defaults.downloadHtmlStaticResources = true;

Back to top

See also: