'HTTP cookie manager not working in jmeter

I have placed cookie manager above the thread group.I have extracted cookie value from sampler request(request1) using regex extractor.I have placed cookie manager with extracted cookie values under the sampler(request2). When i replayed the script the cookie is not set for request2.It shows no cookies. NOTE: When I removed the cookie manager placed above the thread group I am getting errors in samplers.

I have placed cookie manager above the thread group.I have extracted cookie value from sampler request(request1) using regex extractor.I have placed cookie manager with extracted cookie values under the sampler(request2). When i replayed the script the cookie is not set for request2.It shows no cookies. NOTE: When I removed the cookie manager placed above the thread group I am getting errors in samplers.



Solution 1:[1]

HTTP Cookie Manager handles incoming cookies automatically, it:

  1. Extracts the cookies from the Set-Cookie response header
  2. On subsequent requests if domain and path of the request matches the ones of the cookie(s) the cookie is being added to the request's Cookie header

So there is no need to use any post processors for extracting the cookies.

If the cookie manager is "not working" most probably there is a problem with the cookie, i.e. it's expired or domain of the request is different or something like this. If you want to see what's going on under the hood you can increase JMeter logging verbosity for the cookie manager by adding the next line to log4j2.xml file:

<Logger name="org.apache.jmeter.protocol.http.control" level="debug" />

if there are issues with cookies and JMeter is unwilling to add the cookie you can force it by

  1. Choosing less restrictive policy, i.e. netscape

    enter image description here

  2. Adding the next line to user.properties file:

    CookieManager.check.cookies=false
    

More information: HTTP Cookie Manager Advanced Usage - A Guide

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dmitri T