So I get a response something like this:
<!DOCTYPE html>
<html>
<head>
--------------------
</head>
<body>
<script>
function onClickButton(word) {
if (word == 'yes'){
var authorizationCode = '360ad5ce-ecfe-4ad4-83d1-9254e89a3ccc';
var state = 'c8271b81-4229-6a1f-bf9c-758f11c1f5b1';
} else {
alert(word);
}
}
</script>
<div class="shb-psua-sign-app-sandbox-container">
--------------------
</div>
</body>
</html>
How do I get var authorizationCode value? and save it as a variable in postman.
My code for now looks like this:
const $ = cheerio.load(pm.response.text())
var script = $("script").text();
pm.collectionVariables.set("access_token", script);
Now I get the whole script but how do I just get the value of the authorizationCode or even just using the gotten variable to get the value out of it?
I have also looked about different solutions for example:
const script = $('script').find("authorizationCode"); //but this doesn't work