contains in bodyString

I am trying to test the existence of a string “Paged Mode” on the HTML response to play an additional Requette if the string exists.

I get the html response with :

.check(
bodyString.saveAs("""_body""")
)

I can view the HTML response to the console with :

.exec(session => {
val _body=session.getAttribute("_body")
println("HTML body ::: "+_body)
session
})

but, when I try to test whether the word “Paged Mode” exists or not, with the lines below, it does not work! :

.doIf(bodyString.toString().contains(“Mode paginé”))(
exec(http(“request_snake”)
.get("…")
)
)

and either with :

.doIf("""${_body}""".contains(“Mode paginé”))(

You have ideas or other solution to my problem.

Thank you :slight_smile:

.doIf(bodyString.toString().contains(“Mode paginé”))(

No way it would work, bodyString is a check.

.doIf(“”“${_body}”“”.contains(“Mode paginé”))(

No way this would work either as “”“${_body}”“” won’t be parsed.

The proper way is:
doIf(session => session("body").validate[String].map(.contains(“Mode paginé”))) { }

but this should work too:
doIf(session => session(“_body”).as[String].contains(“Mode paginé”)) { }