Each time I execute home page of ecommerce website, some cookies appear in request header some of them have unique values each time we hit Home request which is ai_user & ai_session. I want to know how do I get those unique values in JMeter for each time I hit home request. I recorded test script by blaze meter and it automatically recorded all cookies in HTTP CookieManager as a user defined cookies but those values are hard coded I want them dynamic as it works in browser. I already Change the property CookieManager.save.cookies=true in jmeter properties file.Jmeter.properties file is located in JMeter’s bin folder and use variable ${COOKIE_ai_user} in script to use cookie value. But issue is its value is static I want to make it dynamic, how can I do that?

1

There are 1 best solutions below

1
On

Each time I execute home page of ecommerce website, some cookies appear in request header

No, it doesn't work that way.

  • When you open the page first time the browser gets cookies from Set-Cookie header
  • When you open the page next time the browser sends cookies as Cookie header

So the situation when you're sending cookies at the very first request is highly unlikely to happen (unless you're simulating a returning user)

It's sufficient to add HTTP Cookie Manager which simulates browser's cookie storage and automatically handles incoming cookies.