I want to be able to use .split() on the current element in a foreach for a scenario. Is that possible? For example, I have the following code:
=====
.exec(http("request_18")
.get("/" + site + "//Main/portal/lists/index.cfm?list=tasks")
.check(css("#column_packet_nm.listPageTableCell > a", "href").findAll.saveAs("tasks")))
.exec { session =>
val myTaskID = session("tasks").as[Seq[String]]
session.set("tasks", myTaskID)
}
.pause(4)
.foreach("${tasks}", "task") {
exec(http("${task}")
.get("/" + site + "/Main/portal/lists/index.cfm?list=tasks"))
}
=====
This gives me my strings in the sequence just find. But I want to be able to only grab a certain piece from the string later on.
I'm not sure how to do that with the interpolated string. I have tried a few different things:
=====
exec(http("${task}".split(""""\,"""")(1))
---> Which produces my full string with the split attached as a string.
exec(http("${task.split(',')(1)}")
---> Which gives me a message that my string plus .split(',')(1) is an attribute that can't be found
=====
Any help with this would be appreciated. I'm sure, once again, I'm missing something simple.