Below is my HTML response in Gatling. I am looking to extract the value of the url
field. How do I do that?
script type="text/javascript" id="test">
var initialVars={ "context" : { "A": "XXXX", "B":"XXXXX"}, "u.d" : {"C":"ABC", "D":"FGH"}};
var z = {"desktop": {"Q": "12345"}, "q.d": {"F": "QQQ", "url": "A&B=345=hhh"}}
I'm afraid you'll have no choice but to use regular expressions here. HTML parsers such as Gatling's CSS selectors support won't be of any help as you're trying to capture some data in inlined JavaScript.
Then, your problem has nothing to do with being new to Scala or Gatling. It's about using/learning Java regular expressions.
If you struggle, you should read the Java patterns documentation and try some online evaluator.
Once you have your regex figured out, use it to add a regex check in your Gatling test.