The dynamic cookie parameter(token_id, access_id, state) value passed is not showingup in any response which is making difficult to capture and pass it on further request. Can anybody help me with this?
Have you tried with the Cookie Manager available out of the box. It stores and sends cookies just like a web browser. If you have an HTTP Request and the response contains a cookie, the Cookie Manager automatically stores that cookie and will use it for all future requests to that particular web site. Each JMeter thread has its own "cookie storage area".
If you want to handle the cookies using JSR223 you will have to use Post Processor. Pre-processors are executed before sending the requests. Hence you do not have access to the response values within Pre-processors.
API Documentation will be useful if you really want to manipulate the cookies.
The easiest option is going for HTTP Cookie Manager
Add it to your Test Plan
Add the next line to user.properties file (lives in "bin" folder of your JMeter installation):
CookieManager.save.cookies=true
Restart JMeter to pick up the change
That's it, you should be able to access your cookies as ${COOKIE_token_id}
, ${COOKIE_access_id}
, etc. where required
If you still want to use JSR223 PreProcessor you can extract the cookies from the previous request using prev.getResponseHeaders()
function, however you will need to perform some extra coding in order to:
Set-Cookie
header value
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.