'How to extract a html response and parse it JSON from a GET call in REST ASSURED framework?
In Postman I have did in the below way and want to do the same in Rest Assured framework. I want to parse and save the "tltkt" value in Rest Assured framework. How can I do that in Rest Assured?
GET call :https://prod.streaming/com/account/signin/
Postman tests:** Load the HTML response to $
const $ = cheerio.load(pm.response.text())
console.log($("title").text()); // get title
console.log($('script#app-config').text().trim());
let appConfig = JSON.parse($('script#app-config').text().trim());
console.log(appConfig.tltkt);
pm.collectionVariables.set("saved_tl_tkt", appConfig.tl_tkt);
console.log(pm.collectionVariables.get("saved_tl_tkt"), ":from pm");
Response in HTML:
main id="main-container"
script id="app-config" type="application/json"
{"tltkt":"QVdMcHpmWitoWENSSU8zN0FtYzNmWlJVdFFrQkoxOUVJTE5iOHQvTXZ" , "imageHost": https:\/\/prod-wwwimage-us.com, "regionBaseUrl:""};
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
