Calling headerRegex throws implicit value exception

I am trying to run gatling test where it logs in and checks and store the value of a cookie.

Here’s the code snippet that I have:

.pause(minWait, maxWait)
.formParam(“username”, “${username}”)
.formParam(“password”, “test123”)
headerRegex(“Set-Cookie”, “viafoura_session_id”)
.ofType[(String, String)]
The login and status check part is working fine, but headerRegex always give me the following error during execution:

07:55:03.140 [main][ERROR][ZincCompiler.scala:141] i.g.c.ZincCompiler$ - /home/crengga/projects/vi-vinl/vinl-gatling/src/test/scala/nl/vi/gatling/simulation/OpenSessionsInitializer.scala:63: could not find implicit value for parameter extractorFactory: io.gatling.http.check.header.HttpHeaderRegexExtractorFactory

Am I missing some imports or declarations in my gatling (scala) class?

Not sure if this’ll help much, as I’ve never had to use a header regex, but your second parameter in:

headerRegex(“Set-Cookie”, “viafoura_session_id”)

doesn’t look much like a regex pattern to me, eg. (.+?) or whatever, which could explain the exception headline.

A quick Google search reveals someone else’s usage as:

.check(headerRegex("Set-Cookie","student_id=(.*); path=/").saveAs("student_id"))

What format does your ‘viafoura_session_id’ cookie have (in a response)? Feel free to paste here.

Hi, I tried to do what you posted and it’s still not working:

headerRegex(“Set-Cookie”, “.*”).saveAs(“vf_sess_id”)

This also doesn’t work, also with path=/

My viafoura_session_id cookie’s value looks like this:


The error was turns out to be wrong way of importing the classes. Since I relied on intellij’s auto import, it did not import all needed classes.

Previously was like this:

import io.gatling.http.Predef.{currentLocationRegex, headerRegex, http, regex, responseTimeInMillis, status}

And I changed it to

import io.gatling.http.Predef._