How to add dynamic params?


I have multiple hidden fields that are generated automatically:

And i use regex to collect values:
.check(regex(""“hdnUser” value="([\w=/.\d_%±.]*)"""").findAll.saveAs(“hdnUser”))

I can access “hdnUser” session to get values:
.exec(session => {
var users = session(“hdnUser”).as[Seq[String]]
users.foreach(user => {

Now, I’d like to add them to params dynamically in next post as below, how can i achieve this by using session(“hdnUser”) above?
.param(""“ctl00$PlaceHolderMain$dtlUsers$ctl00$hdnUser”"", “”“pa0"”")
.param(""“ctl00$PlaceHolderMain$dtlUsers$ctl01$hdnUser”"", “”“pa1"”")
.param(""“ctl00$PlaceHolderMain$dtlUsers$ctl02$hdnUser”"", “”“pa2"”")
.param(""“ctl00$PlaceHolderMain$dtlUsers$ctl03$hdnUser”"", “”“pa3"”")

Thanks in advance.

Is it expected that input names and param names differ ($ instead of _)?

ctl00_PlaceHolderMain_dtlUsers_ctl00_hdnUser vs ctl00$PlaceHolderMain$dtlUsers$ctl00$hdnUser

I’m using and server generate id with “_” and name with “$”. When post to server, it just recognize “$” so we must use “ctl00$PlaceHolderMain$dtlUsers$ctl00$hdnUser” for param in post.
I was able to achieve this by:
var users = session(“hdnUser”).as[Seq[String]]
var b = Seq((“b”,“5”),(“c”,“4”))
var i = 0;
users.foreach(user => {
var name = “ctl00$PlaceHolderMain$dtlUsers$ctl0”+ i.toString +"$hdnUser"
b = b :+ (name,
i = i + 1;

Thanks for your help.

Oups, sorry.

A proper solution with upcoming version is to use a regex with 2 capture groups (one for name and one for value):

regex("foo(.*)bar(.*)baz").ofType[(String, String)]

and then directly post the pairs:

  • paramsSeq(seq: Expression[Seq[(String, Any)]])


regex(""“hdnUser” value="([\w=/.\d_%±.]*)"""")…ofType[(String, String)]

throw error:
value ofType is not a member of io.gatling.http.check.HttpMultipleCheckBuilder[CharSequence,String]
regex(""“hdnGroupLevel” value="([\w=/.\d_%±.$]*)"""").ofType[(String, String)],

i’m using Gatling 2.0.0-SNAPSHOT.

You use an old snapshot. HttpMultipleCheckBuilder doesn’t even exist anymore.

I’m get Gatling from Maven:

Sonatype OSS





Where can i get latest?