web.regAddCookie

Registers a search for a text string and adds a cookie if the text is found.

Syntax

web.regAddCookie( {object} );

JavaScript Object

{
   {
      name:"<string>,
      value:"<string>",
      domain:"<string>", 
      expires:"<string>", 
      path:"<string>",
      secure:""
   },
   searchString: "<string>"
}
For details on the elements of the Cookie, see RFC6265.
Property Name
Description
nameThe cookie name.
domainThe domain of the web server.
expiresThe cookie expiration time.
pathThe cookie path
secureNo value.
searchstring
The text string for which to search. This attribute must be a non–empty, null–terminated character string. Use the format "text=string".

Return Values

Not applicable

Parameterization

All arguments can be parameterized using standard parameterization.

General Information

The web.regAddCookie function registers a search for the text string specified by the searchstring argument. If the searchstring is found on the web page retrieved by the next action function, the specifed cookie is added.

 

Note that, although web.regAddCookie is functionally similar to an HTTP Set_Cookie header, there is a significant difference. According to the HTTP standard, the domain attribute is optional in a Set–Cookie header from a server . If not specified, the default value of domain is the host name of the server that generated the cookie response. Since this information is not available to the load generator host when web.regAddCookie is called, the domain attribute is required.

This function can be used for both HTML–based and URL–based scripts (see Recording Options > Recording tab). It registers the search request before the buffers arrive, so the buffers are scanned as they come. This results in a more efficient script with better performance.

web.regAddCookie is added to the script by the user. It is not recorded.

Example

web.regAddCookie("client_id=RosingsPark127B; path=/; expires=Wednesday, 09-Nov-2011 23:12:40 GMT; domain=www.pemberley.com", "Darcy");