Home > Back-end >  Scrapping data with puppeteer in Nodejs, Results are different
Scrapping data with puppeteer in Nodejs, Results are different

Time:03-10

I want to scrap the text '1 views' from this URL "https://www.loom.com/share/5b920dc1375f43fa9b622ac0a6ba7c52"
Url of image: https://imgur.com/r8dbUbV

In browser console it gives result perfectly
Url of image: https://imgur.com/Z4XrR3f

but in puppeteer it gives 'Record a loom'
Url of image: https://imgur.com/zL1varD

CodePudding user response:

I noticed a similar issue when trying different browsers. Your selector worked fine for me in Firefox, but not in Chrome. I'm assuming you are using Chrome with Puppeteer, as it is the default. If that's the case we are likely seeing the same issue. Anyway, try this selector out instead:

document.querySelector(`[class*="header-content"] span:nth-child(2)`)

Happy scraping, and cheers!

  • Related