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

302
Views
Puppeteer - why is innerText not printed on console while every element does?

I'm trying to access innerText of a list of 8 els (elements).
When I map over els and console.log(el) I see 8 elements neatly printed in my console of browser.
But when I console.log(el.innerText) I am getting just 3 or 4 texts printed out in my console.

I don't understand, what is happening here?

  // wait for all cards to appear on page
  await page.waitForSelector(".card.cardItem:nth-of-type(8)", { timeout: 0 });

  await page.$$eval(".card.cardItem", (els) => {
    els.map((el) => {
      // logs out 8 elements (all have innerText on webpage).
      console.log(el)

      // logs out innerText of only 3 elements. Why?
      console.log(el.innerText);
    });
  });
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I got it to work with using textContent instead. I don't understand why, but it works. I will keep question open as I'm still curious why innerText doesn't work here so if someone knows feel free to explain to us.

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!