Browser emulation overview

Note: Applies to: Web Vuser protocols. For a list of web Vuser protocols, see Web Vuser types.

When you run a web Vuser that accesses a website, the Vuser does not use an actual browser to access the site. Instead, the Vuser emulates a browser accessing the site. To enable the emulation, the Vuser uses a user-agent string.

What is a user-agent string?

When a browser sends a request to a server, the browser sends a user-agent string that identifies itself to the server. The identifying details in the user-agent string are included in various tokens. These tokens provide various details such as which browser is being used, the version of the browser, and the operating system on which the browser is running.

The user-agent string is included in a User-Agent header that is part of every request that is sent by the browser to the server. Servers can use the information that is contained in the user-agent string to provide content that is tailored for the specific browser.

Below is an example of a User-Agent header that contains a user-agent string that is sent to a server. In this example, the user-agent string identifies the browser as Internet Explorer 11.0, running under Windows NT 10.

User-Agent: Mozilla/5.0 (Windows NT 10.0; Trident/7.0; rv:11.0) like Gecko

Back to top

Emulate a specific browser

When you run a web Vuser that accesses a website, the Vuser emulates a browser accessing the site. To enable the emulation, the Vuser creates a user-agent string that includes various tokens.

  • The Browser and Version tokens define the browser to emulate and the version of the emulated browser.
  • The Platform token defines the operating system on which the emulated browser is running.
  • The Language token defines the language for which the emulated browser is localized.

The user-agent string is included in a User-Agent header in every request that the Vuser sends to the server that hosts the web-site.

Back to top

What information is included in web Vuser's user-agent string?

  1. When a Vuser script is first created, the browser in the user-agent string is Internet Explorer 6, and the operating system is Windows.
  2. After the code in a Vuser script is generated, the browser in the user-agent string is changed to the browser that was used when the script was recorded, and the operating system is changed to the operating system that was used when the script was recorded.

After the code in a Vuser script is generated, you can use the Vuser script's runtime settings to specify an emulated browser that is different from the browser that was used when the script was recorded. There are scenarios in which this enables you to more accurately emulate the real-world situation. When you specify the emulated browser, you can specify the browser type and version, the platform on which the Vuser runs, and the language for which the browser is localized. VuGen creates a user-agent string that includes the details that you specify. If required, you can edit the user-agent string to create a customized user-agent string.

To specify a different browser to emulate:

  1. Open the Vuser script.
  2. Click Replay > Runtime Settings.
  3. In the runtime settings dialog box, click Browser > Browser Emulation, and then select Use Browser.
  4. Select from the lists of available options to specify the browser to emulate.

    Note: The User-Agent String that is displayed is updated after each selection that you make.

To customize the user-agent string:

  1. Open the Vuser script.
  2. Click Replay > Runtime Settings.
  3. In the runtime settings dialog box, click Browser > Browser Emulation, and then select Use Custom.
  4. Modify the user-agent string as required.

Back to top

Maximum number of concurrent connections

When a browser accesses a web-site, the browser maintains a number of concurrent connections with the web server that hosts the web-site. Therefore, when you access a web page that contains many different objects, such as images, Javascript files, frames, data feeds etc, the browser may try to improve performance by downloading several of the objects simultaneously. The maximum number of concurrent connections is dependent on the browser type, and the version of the browser.

When you run a web Vuser, by default, the maximum number of concurrent connections that the Vuser can maintain with a web-server is defined by the browser that is specified in the Vuser script's user-agent string.

To override the default maximum number of connections value:

You can use the MAX_CONNECTIONS_PER_HOST option in the web_set_sockets_option function. For details, see the Function Reference (select the relevant version).

The following example sets the maximum number of concurrent connections to 10:

web_set_sockets_option("MAX_CONNECTIONS_PER_HOST", "10");

Note: When you run a web Vuser script, the maximum number of concurrent connections that the Vuser can maintain with the server appears in the Replay log.

Back to top