Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

134
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda