0
votes

I have recorded script and run jmeter. the Session id and Xsrf tokens are passing request header cookies in browser cookies. but,session id is not passing in jmeter. So, connection closed error occurring.

How can i extract session id and xsrf token using regular expression extractor?

enter image description here

2

2 Answers

1
votes
  1. Add the next line to user.properties file (located in the "bin" folder of your JMeter installation)

    CookieManager.save.cookies=true
    
  2. Restart JMeter to pick the property up
  3. Add HTTP Cookie Manager to your Test Plan
  4. Now you should be able to refer cookie values as:

    • ${COOKIE_session} and
    • ${COOKIE__xsrf} where required

More information: Using the HTTP Cookie Manager in JMeter

0
votes

You can use XPath extractor and enter "//input[@name='_csrf']/@value" to get the csrf token value and then enter desired reference name for example "csrf_token" and use the variable ${csrf_token} wherever necessary