Extract Javascript From Html Response In Karate
I need help here. I have a POST request which returns response with a HTML response and this HTML response contains javascript inside it. I need to extract text/javascript where it
Solution 1:
Use a Java regex:
* defpattern = java.util.regex.Pattern.compile('checkout =.+(\\{[^;]+)')
* defmatcher = pattern.matcher(response);
* assert matcher.find()
* defbody = matcher.group(1)
We will be adding this as a karate.extract()
helper in 0.9.6.RC3 onwards: https://github.com/intuit/karate/issues/1094#issuecomment-616059232
EDIT - better, detailed example: https://stackoverflow.com/a/67331307/143475
Post a Comment for "Extract Javascript From Html Response In Karate"