JMeter clear cookie after HTTP Request in same iteration

I am struggling with the cookies to clear after certain step. This is what I have in a sample test plan enter image description here enter image description hereenter image description hereenter image description here I am getting a data from CSV file and then I have multiple cookies - which are location IDs which I need to pass for each row from CSV. I have tried using the Cookie Manager with option to clear iteration which works fine for next row from CSV but not to loop through cookie list defined in the user defined variable. I looked at this article I have tried adding this code at the same level as the HTTP request but get an error

1 answer

  • answered 2019-12-09 14:55 Dmitri T

    sampler.getCookieManager().clear() function should do the trick for you


    enter image description here

    Given you're getting an NPE most probably something is wrong with your HTTP Cookie Manager configuration, you can try enabling debug logging for it to see if JMeter "complains" on anything and if it does - fix the HTTP Cookie Manager configuration accordingly.

    In order to get extended debug information for the HTTP Cookie Manager add the next line to log4j2.xml file:

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

    JMeter restart will be required to pick the property up.