HTTP cookie Manager in Apache JMeter

It serves the following purpose: It stores and sends cookies like a web browser. The jmeter stores the cookies, directed back by the server, saves them and send them, if needed. It also serves the purpose to manually add the cookies. Though this practice is not recommended until the user is not sure, what he is doing.

How can anybody set the cookie that has been directed back by the server?
It can be seen using the listener: view result tree. The sampler result tab of the response contains the information about the cookies. Given below is a possible cookie format.

 Set-Cookie: cookie-name= ***** ; path:/******/ ; HttpOnly 

Can we use the received cookies as thread variables?
Yes, the received cookies can be used as thread variables. To save cookies as variables, set the property ” to true inside the file.

For a cookie named: ‘TEST’, the variable is stored as COOKIE_TEST and can be accessed as ${COOKIE_TEST}. The prefix is added in order to avoid any mix-up with other local variables. This property can be disabled by changing the property, = *spaces*.

Control Panel :

HTTP cookie Manager


Some details about the parameter.

Attribute Description Required
Name Descriptive name for this element that is shown in the tree. No
Clear Cookies each Iteration If selected, all server-defined cookies are cleared each time the main Thread Group loop is executed. In JMeter versions after 2.3, any cookies defined in the GUI are not cleared Yes
Cookie Policy The cookie policy that will be used to manage the cookies. "compatibility" is the default, and should work in most cases. See and [Note: "ignoreCookies" is equivalent to omitting the CookieManager.] Yes
Implementation HC3CookieHandler (HttpClient 3.1 API) or HC4CookieHandler (HttpClient 4 API). Default is HC3CookieHandler.
[Note: If you have a website to test with IPv6 address, choose HC4CookieHandler (IPv6 compliant)]
User-Defined Cookies This gives you the opportunity to use hard-coded cookies that will be used by all threads during the test execution.
The "domain" is the hostname of the server (without http://); the port is currently ignored.
ADD button Add an entry to the cookie table. N/A
Load button Delete the currently selected table entry. N/A
Delete button Load a previously saved cookie table and add the entries to the existing cookie table entries. N/A
Save as button Save the current cookie table to a file (does not save any cookies extracted from HTTP Responses). N/A