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

137
Visualizações
Get text value from especific class in web site

I want to know if it is possible to go to a site and retrieve the text of an element

i think something like

a = page("www.site.com")
b = a.getElementByClass("name")
console.log(b.text)

this is possible?

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

0

Yes. It's called the innerText property. See https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/innerText

about 4 years ago · Juan Pablo Isaza Relatório

0

That depends,

If you want to get the innerText of the elements, then

let elements = document.getElementsByClassName("YourClassName");
for(let i=0;i<elements.length; i++){
  /*doSOmething*/
   console.log(elements[i].innerText);
}

Many elements may have same className. So, if you want to access some specific Element, then you should either know the index of the element or you need to use id for the element.

let element = document.getElementById("YourElementId");
  /*doSOmething*/
console.log(element.innerText);
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