Search code examples
cookiesjmeteruitestcookiemanager

How to pass cookies in jmeter (browser cookies and manualy add cookies in same time)


I want to pass browser automatically store cookies and manually added cookies in JMeter request. enter image description here

Default cookie manager to use to get default cookies to browser create into pet-type-3. HTTP Cookie Manager uses to add manually cookies to that request. but that request also passes only default requests in browser creation.

How to pass these two types of cookies in this request.


Solution

  • Given you're providing valid cookies which match domain and path - they will be added along with the cookies coming in Set-Cookie response header

    Demo:

    enter image description here

    as you can see by cookie foo with the value of bar has beed added to the "normal" cookies used by google

    So I believe you just need to move your HTTP Cookie Manager to be direct child of the Thread Group as currently it's being applied to /pet-type-3 sampler only and in order to catch the cookies you call "browser" ones it need to be applied to all HTTP Request samplers.

    More information: JMeter Scoping Rules - The Ultimate Guide