The host names of all URLs within a generated Web script are auto parameterized through use of the generated variable
n is an instance of a host. Many hosts can be navigated within a single script. Parameterization is achieved via
getString() with the default argument set to the host value encountered at the time of recording.
In the following example the script was recorded against the host
bosch and will replay against this host unless a data source is set up containing a value for
FcUrl _url; //a URL object for Web navigation
startTransaction("Go To Home");
// Request: 1, GET, http://bosch:8080/, response code=200 OK
// Page Title: Home
// References to the following page resources could not be found within the contents of the
// received web page. This can occur because resources are fetched as a result of style
// sheets or the browser executing script
_url.addPageResource("http://" + _host1 + ":8080/animal.gif"); // Request: 2
_url.addPageResource("http://" + _host1 + ":8080/banner.gif"); // Request: 3
_url.addPageResource("http://" + _host1 + ":8080/power.gif"); // Request: 4
endTransaction("Go To Home");
public: void script()
_host1 = getString("_host1", "bosch");
User Agent Header
The user agent string is a header name/value pair sent by the client in order to tell the server what type of agent is making the request. User agents are typically browser types. Parameterization is achieved via
getString() with the default argument set to the browser used for recording.
In the following example the user agent string is set to Internet Explorer 7 and will replay as such unless a data source is set up containing the value for "User-Agent".
setUserAgent(getString("User-Agent","Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)"));