Getting Error: value forEach is not a member of io.gatling.http.request.builder.HttpRequestBuilder

val rcvr: ScenarioBuilder = scenario("Receiver")
    .exec(
      polling
          .every(10 seconds)
            .exec(http("Get Payments")
              .get(s"$Url/payments")
              .headers(Map(
              "Authorization" -> s"Bearer ${access_token}",
              "CID" -> "${CID}",
              "Content-Type" -> "application/json"
              ))
              .queryParam("states", "StateA")
              .check(status.is(200))
              .check(jsonPath("$.payment_id")
              .findAll
              .saveAs("payment_ids")))

              .forEach("${payment_ids}", "payment_id") {
                exec { 
                  session =>

val current_id = session("payment_id").as[String]

                  exec(http("Finalize Payment")
                    .post(s"$Url/payments/" + "${current_id}" + "/finalize")
                    .headers(Map(
"Authorization" -> s"Bearer ${access_token}",
                      "CID" -> "${CID}",
                      "Content-Type" -> "application/json"
                    ))
                    .body(StringBody("""{"user_info": "some info"}""")).asJson
                    .check(status.is(200))
                    .check(jsonPath("$.payment_state").is("Final"))
                  )
                  session
                }
              }

            .exec(http("Get Payments")
              .get(s"$Url/payments")
              .headers(Map(
"Authorization" -> s"Bearer ${access_token}",
              "CID" -> "${CID}",
              "Content-Type" -> "application/json"
              ))
              .queryParam("states", "StateB")
              .check(status.is(200))
              .check(jsonPath("$.payment_id")
              .findAll
              .saveAs("payment_ids")))

              .forEach("${payment_ids}", "payment_id") {
                exec { session =>

val current_id = session("payment_id").as[String]

                  exec(http("Complete Payment")
                    .post(s"$lonUri/v4/payments/" + "${current_id}" + "/complete")
                    .headers(Map(
"Authorization" -> s"Bearer ${lon_access_token}",
                      "CID" -> "${CID}",
                      "Content-Type" -> "application/json"
                    ))
                    .body(StringBody("""{"user_info": "some info"}""")).asJson
                    .check(status.is(200))
                    .check(jsonPath("$.payment_state").is("COMPLETED"))
                  )
                  session
                }
              }
    )
    .exec(polling.stop)

You’re missing a ) to close the previous exec.

Can I not have multiple execs inside my polling? The idea is to have both the Get Payments calls run every 10 seconds.

Also, closing the first exec by adding the ‘)’ throws a new error: