Deepak Gupta
Deepak Gupta

Reputation: 1

Loop asLongAs() in Gatling using Scala

`I am trying to use a loop e.g. asLongAs() in Galing but not getting enough data on google about how to use. My scenrio is to open a HTML page and that page takes some time to load and for that I have a css selector to check that once the report get loaded we have one css selector to check in the source code. my code is like:

`exec (http("ABC -${ID} - Id -${ID2}")
.get("web/a/b/c/")
.check(css(.abc).saveAs("URL"))
.exec(session =\> {
val response = session("URL").as\[String\]
println(s"url is: \\n$response")
session
})
exec(http("Open the redirected report - ${ID1} Id-${ID2}")
.get(session =\> session("URL").as\[String\])
Some checks
.check(css(".Image").exists)`

I want to create a loop till this css(.Image) is loading. Because once the URL is hitting at that time this CSS doesn't appear and it takes time to load and i want to calculate that time only.

Upvotes: 0

Views: 358

Answers (1)

Stéphane LANDELLE
Stéphane LANDELLE

Reputation: 6600

but not getting enough data on google

Have you tried the official documentation ? It has samples for Java, Scala and Kotlin. https://docs.gatling.io/reference/script/core/scenario/#aslongas

Upvotes: -1

Related Questions