web.addCookieEx

Adds a cookie or cookies with the specified add behavior.

Syntax

web.addCookieEx( [{object},{object},...] );

JavaScript Array of Objects

[
 {
   insert: "<string>",
   allowEmptyDomain: "<string>",
   name:"<string>",
   value:"<string>", 
   domain:"<string>", 
   expires:"<string>", 
   path:"<string>", 
   secure:""
 }
]

For details on the elements of the Cookie, see Internet Standards Track document RFC6265.

Property Name
Description
Insert
Optional. Either "Default" or "Alt". If "Alt", the cookie is inserted as the first in the cookie table. Otherwise, it is inserted at the default location. The default is "Default".
allowEmptyDomain
Optional. Either "yes" or "no". If "yes", the domain element in the cookie can be empty. The default is "no".
nameThe cookie name.
domainThe domain of the web server.
expiresThe cookie expiration time.
pathThe cookie path
secureNo value.

Return Values

Not applicable

Parameterization

The following argument(s) can be parameterized using standard parameterization: Cookie

General Information

The web.addCookieEx function adds a new cookie or cookies with the option to place the cookie at the beginning of the cookie table, and to allow an empty domain. If the name and path match an existing cookie, the existing cookie is overwritten with the new one. If the "expires" date has past, the cookie is deleted.

Although scripts handle cookies automatically, there may be cases when you need to manually control the cookies.

Note: Scripts do not use (access or modify) the cookies that are stored by your browser. Instead, each script uses the cookies that are sent to the Vuser by the server host at runtime. These cookies are maintained only temporarily while the script runs. The web–cookie functions (web.addCookie, web.addCookieEx, web.removeCookie, and web.cleanupCookies) manipulate these temporary cookies only.

The intended use of web.addCookieEx is to add cookies usually stored in the browser, prior to starting the run.

Example

web.addCookieEx(
   [
    {
      name:"client_id",
      value: "China127B",
      path: "/",
      expires :"Wednesday,09-Nov-2020 23:12:40 GMT",
      domain : "www.mycompany.com",
      insert:'Alt',
      allowEmptyDomain:'yes'
     }
    ]
 );
 

Alternate form:

web.addCookieEx(
   [{
     insert:'Alt',
     allowEmptyDomain:'yes',
     cookie: "Cookie=client_id=China127B; path=/; expires=Wednesday, 09-Nov-2020 23:12:40 GMT; domain="
   }]
));