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

Please, let me know how to parse some fields from HTML response to next request.
Similar to this command for JSON response

var data = JSON.parse(responseBody);

I’m trying to get fields by id from

<!DOCTYPE html>

    <input type="hidden" name="ID1" id="ID1" value="dfbldbldb" />
    <input type="hidden" name="templateID" id="templateID" value="sdfjsbh skjd" />
    <input type="hidden" name="ID2" id="ID2" value="sfsighs87y" />
    <input type="hidden" name="templateName" id="templateName" value="template name here" />


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);
sdfjsbh skjd
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

Still i am unable to extract a value : Please help me further in detail

My Response in HTML is


What are you trying to extract?

Hi Thanks for the reply. I am extracting a token value which lies between HTML tag

and also there are plenty of attributes in the table. This is why i am unable to extract the particular token value.

How to extract all the href links with submit link only

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Encompass Import System: Loans Processed</title>
<link rel="stylesheet" type="text/css" href="/Encompass/css-table.css">
<script type="text/javascript" src="/Encompass/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="/Encompass/Encompass.js"></script>
<table width="100%"><caption>Loans in process queue (Sorted by last modified)</caption>
<th scope="col">File Name</th>
<th scope="col">Loan Number</th>
<th scope="col">Date Created</th>
<th scope="col">Last Modified</th>
<th scope="col">Request</th>
<tr><td>FILECheckTestLoans.xlsx</td><td><a href=/LoanServicing/GetLoanData?loannumber=1000043845 target=loanDetail>1000043845</a></td><td>2021-03-04 15:37:49.437</td><td>2021-03-04 15:37:49.437</td><td><a href=/Encompass/RunUpdate?id=26088&requestId=1614893866191&ln=1000043845 target=_new>Submit</td></tr><tr><td>FILECheckTestLoans.xlsx</td><td><a href=/LoanServicing/GetLoanData?loannumber=1000043833 target=loanDetail>1000043833</a></td><td>2021-03-04 15:37:49.437</td><td>2021-03-04 15:37:49.437</td><td><a href=/Encompass/RunUpdate?id=26089&requestId=1614893866191&ln=1000043833 target=_new>Submit</td></tr><tr>