1

Hi I want to extract a value from a cookie and pass that cookie value as a parameter to the next exec(). I found some syntax which does not work for the new Gatling 2. Could someone please show an example?

Thanks

4

2 回答 2

5

Answered on Gatling Goole Group: extract with a regex from the "Set-Cookie" header:

.check(headerRegex("Set-Cookie", "yourRegexHere").saveAs("attributeName"))
于 2014-08-28T08:27:55.683 回答
1

Gatling can deal directly with cookies. This copies the JSESSIONID cookie in the session from which it can be retrieved.

exec(getCookieValue(CookieKey("JSESSIONID").withPath("/ApplPath")))
exec(session => "JSESSIONID=" + session("JSESSIONID").as[String]; session)

See Gatling current documentation https://gatling.io/docs/current/http/http_helpers/

于 2020-11-16T15:31:10.040 回答