I try to fetch all link of images from 1st search page using Puppeteer but I only get 6 links from total 40. Here is my code :
const puppeteer = require('puppeteer');
puppeteer.launch({ headless: true }).then(async browser => {
const page = await browser.newPage();
await page.goto('https://shopee.vn/search?keyword=iphone%20xs' , {waitUntil: 'networkidle0'});
const links = await page.evaluate( () => {
let products_result = document.getElementsByClassName("_1T9dHf _3XaILN");
let images = [];
for(let i=0; i<products_result.length; i++){
images[i] = products_result[i].src;
}
return images;
});
for(let i=0; i<links.length;i++){
console.log('Links of ' + i +' images : ',links[i]);
}
await browser.close();
});
What should I fix to get total 40 links from 1st search page ? Thanks.