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

360
Views
Puppeteer querySelector returns null, impossible to get data from the url

i am discovering puppeteer. I want to scrap some data with it, but this url return null value on querySelector. I tried to screenshot the page, error : you are not authorised to access this content. I tried to set the specifyAgent, but it's doesn't work. I tried some solutions on stackoverflow, but none of them worked. here's my code.

const puppeteer = require("puppeteer");


const url =
  "https://www.cdiscount.com/juniors/lego/lego-star-wars-75192-millennium-falcon-ultimate/f-1202809-leg5702015869935.html?idOffre=1218498437#mpos=0|mp";



  
async function start() {
  const browser = await puppeteer.launch();
  //test the userAgent
  //console.log(await browser.userAgent());

  const page = await browser.newPage();

  await page.setUserAgent('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/100.0.4889.0 Safari/537.36');
  
  await page.goto(url);
  
  await page.screenshot({path: 'headless-test-result.png'});
  
  let data = await page.evaluate(() => {
    return document.querySelector("span[itemprop=price]").innerText;
  });
  
  console.log("the price is " + data);

  await browser.close();
}start()

Here is the code with an example link that does not work.

about 4 years ago · Juan Pablo Isaza
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!