Getting HTML response - want to parse certain fields to next request

Hey @yglprn. The Postman Sandbox has cheerio as one of the supported libraries which you can use to parse HTML responses. Here’s what your use case might look like.

var html = cheerio(responseBody),
 id1 = html.find('#ID1').attr('value'),
 templateId = html.find('#templateID').attr('value'),
 id2 = html.find('#ID2').attr('value'),
 templateName = html.find('#templateName').attr('value');
 
console.log(id1, templateId, id2, templateName);
/*
dfbldbldb
sdfjsbh skjd
sfsighs87y
template name here
*/

You can update the value specified in.attr() as per your needs. Feel free to reach out if you have additional queries.

1 Like