Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

388
Visualizações
Postman - extracting value from HTML description list

I've searched for a while trying to find a way in Postman to extract a HTML description list value from the response body where the description list contains multiple values.

Example of response body:

<dl>
                    <dd>Fruit</dd>
                    <dt>Apple</dt>

                    <dd>Vegetable</dd>
                    <dt>Carrot</dt>
</dl>

How do I just get just the Vegetable value? I've tried using the following

const $ = cheerio.load(pm.response.text())
console.log('Vegetable', $('dt').text())

This then returns both values

"Vegetable" "AppleCarrot"

The Fruit & Vegetable values will change once the request is rerun, this means I'm unable to go just based off their names.

I'm probably over thinking this, thanks in advance.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

EricG posted the following above.

JQuery allows you to filter based off order using the following:

const $ = cheerio.load(pm.response.text())
console.log('Vegetable', $('dt').first().text())

Alternatively to the above if you need to go further down the list you can use:

const $ = cheerio.load(pm.response.text())
console.log('Vegetable', $('dt').eq(0).text())

Changing the value in .eq(#) starting from 0 will then following the items down the list.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda