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

89
Views
Having trouble scraping a particular element on a website using Puppeteer

I am trying to scrape the key features part of the website with the URL of: "https://www.alpinestars.com/products/stella-missile-v2-1-piece-suit-1" using puppeteer - however, whenever I try to use a selector that works on the chrome console for the website the output for my code is always an empty array or object. For example both document.querySelectorAll("#key\ features > p") and document.getElementById('key features') both return as empty arrays or objects when I output it through my code but work via chrome console.

I have attached my code below:

const puppeteer = require('puppeteer');

async function getDescripData(url) {
    const browser = await puppeteer.launch({headless: true});
    const page = await browser.newPage();
    await page.goto(url);
    const descripFeatures = await page.evaluate(() => {
        const tds = Array.from(document.getElementById('key features'))
        console.log(tds)
        return tds.map(td => td.innerText)
    });
   console.log(descripFeatures)
    await browser.close();
    return {
        features: descripFeatures
    }
}

How should I go about overcoming this issue?

Thanks in advance!

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

0

Your problem is in Array.from you are passing a non-iterable object and return null.

This works for me:

const puppeteer = require('puppeteer');
const url = 'https://www.alpinestars.com/products/stella-missile-v2-1-piece-suit-1';
      (async () => {
        const browser = await puppeteer.launch({
          headless: false,
          defaultViewport: null,
          args: ['--start-maximized'],
          devtools: true
        });
        const page = (await browser.pages())[0];
        await page.goto(url);
        const descripFeatures = await page.evaluate(() => {
          const tds = document.getElementById('key features').innerText;
          return tds.split('• ');
        });
        console.log(descripFeatures)
        await browser.close();
      })();
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!