<!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
const response = pm.response.text();
//find a match with a regex
let authCode = response.match(/authorizationCode = '(.*?)';/g);
//remove first and last characters as needed with slice;
console.log(authCode[0].slice(21, -2));
Could you help me guilde on how to get “Tekening naam” under the “Informatie” column and “ASN-AFS-B8822.dwg” under the “Data” column using Postman?
Thanks for your help!
I’m a new to automation API using Postman.
function tableToJson(table) {
var data = [];
for (var i = 1; i < table.rows.length; i++) {
var tableRow = table.rows[i];
var rowData = [];
for (var j = 0; j < tableRow.cells.length; j++) {
rowData.push(tableRow.cells[j].innerHTML);
}
data.push(rowData);
}
return data;
}
But the problem is that the table is being treated as a string.
So all of the functions I’ve tried for converting a table to an object are failing at the first hurdle (retrieving the number of rows) as its being treated as a string, not a table. Not sure if this is just because of how Postman is rendering this.