Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

130
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!