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

473
Views
Puppeteer: How get img src inside nested selector?

I have a structure like this:

<div class="loaded active">
<img class="full" src="img1.jpg">
</div>

<div class="loaded">
<img class="full" src="img2.jpg">
</div>

<div class="loaded">
<img class="full" src="img3.jpg">
</div>

I need get link of img1.jpg. I can get links for class="full":

const slkImg = '.full';
    
const imgs = await page.$$eval(slkImg, postLinks => postLinks.map(link => link.src));

but I don't know how do it for only img1.jpg.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

As discussed in the comments,

page.$eval('.loaded.active .full', el => el.src)

works thanks to two things:

  1. Using $eval rather than $$eval to select one element
  2. Using .loaded.active .full to select the first .full descendent of the first .loading.active parent.
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!