Hi Team,
It would be life saver if someone could help, with the getting the value inside the script tag as seen from the below image?.. attribute named “window.RequestVerificationToken”
@sonutitus Cheerio would be a good option here:
I saw a similar post here. Kindly go though this to know more about cheerio 
You can try the below snippet,
I just worked roughly since only the snapshot of the response in provided.
const $ = cheerio.load(responseBody);
//console.log($.html());
console.log($("script[windowRequestVerficationToken]").val());
Hi @bpricilla
Thank you for the reply ![]()
I couldn’t fetch the value using the above resolution, so I am sharing the html response.
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta author="Test data">
<meta name="description" content="Test Admin Platform">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" id="favicon" type="image/x-icon" href="/favicon.ashx?random=09412021">
<script>
window.RequestVerificationToken = 'CBnB25ZY1CVQL4ReM0qzAs_StmlUd2W2FDlG_jOnEuz4M5_3eKZ0xjlfxQdDMlUqVyCaFwYkFadOZauk1GMgwXsam8z5sH-vcxXuq4OF-Os1:jRpBEiVZHiSw7uZQ8J3gCrUPOQB7DdWEcRROiQ38izHsEgeKXNjmaS6WFAqwEcvPKwEvvAvwly5T4T6p3x_7_N1KmltGZBEVlP3FDEdr7ODdKidgPwgXVWERKZco4eWV0';
</script>
<title> QA - Dashboard </title>
<link href="/admin/Content/css?v=m-g1hzBEAwRLe9AfwA4CizfS_1A1AB4GcXnTUjKDCIU1" rel="stylesheet" />
<link href="/admin/FreeTrial/Tour?v=jkAKiMEku7GE0j6LMaS8Qa6jpTUyyrXbhoKKWIh-yKI1" rel="stylesheet" />
<script src="/admin/bundles/modernizr?v=inCVuEFe6J4Q07A0AcRsbJic_UE5MwpRMNGcOtk94TE1"></script>
@bpricilla
I am presently using the below code, but this would fail if the script tag is changing length.
> **const** $ = cheerio.load(pm.response.text());
>
> var str=$('script')[0].children[0].data
>
> //console.log(str)
>
> var mySubString = str.substring(
>
> str.lastIndexOf("= '") +3 ,
>
> str.lastIndexOf(";") -1
>
> );
Thaks for sharing it, but before that. I missed a minute detail. can you try as below
const $ = cheerio.load(responseBody);
//console.log($.html());
console.log($("script[window.RequestVerificationToken]").val());
@bpricilla
The above code is giving error
![]()