Garuna
Garuna

Reputation: 1

JMeter can't find token in any response

I'm trying to record a script in JMeter. I'm getting a 401 error in the login request. I see that the login request is sending a token to the server and I have to correlate this token however I'm not able to find any token in the response body or response header of any previous request. What should I do?

Upvotes: 0

Views: 934

Answers (1)

Dmitri T
Dmitri T

Reputation: 168157

There are 4 sources where the "token" could come from:

  1. Response body

  2. Response headers (including cookies)

  3. URL (as a result of a redirection), if this is the case you might need to play with Redirect Automatically and Follow Redirects checkboxes in the HTTP Request sampler (or HTTP Request Defaults)

    enter image description here

  4. The token can be generated by JavaScript. As per JMeter project main page:

    JMeter is not a browser, it works at protocol level. As far as web-services and remote services are concerned, JMeter looks like a browser (or rather, multiple browsers); however JMeter does not perform all the actions supported by browsers. In particular, JMeter does not execute the Javascript found in HTML pages. Nor does it render the HTML pages as a browser does (it's possible to view the response as HTML etc., but the timings are not included in any samples, and only one sample in one thread is ever displayed at a time).

    so if this is the case - you will have to replicate the logic of the associated JavaScript function(s) using JSR223 PreProcessor

Upvotes: 1

Related Questions