Forum Replies Created

  • To scrape the rating from HomePro Thailand, you’ll need to locate the element that contains the review score or star rating. This is usually found within a span tag or a div class that includes stars or text indicating the product’s rating. Using Puppeteer, you can extract the rating text once the page is fully loaded.

    const puppeteer = require('puppeteer');
    (async () => {
        const browser = await puppeteer.launch({ headless: true });
        const page = await browser.newPage();
        await page.goto('https://www.homepro.co.th/en/product-page');
        const rating = await page.$eval('.product-rating', el => el.innerText);
        console.log('Rating:', rating);
        await browser.close();
    })();
    
  • To scrape the product rating, use Puppeteer to find the rating element, which is often inside a div or span containing star icons or numerical ratings. After waiting for the element to load, extract the rating text using page.$eval(). This can help you gather insights into how well a product is reviewed.

    const puppeteer = require('puppeteer');
    (async () => {
        const browser = await puppeteer.launch({ headless: true });
        const page = await browser.newPage();
        await page.goto('https://example.com/product-page');
        const rating = await page.$eval('.product-rating', el => el.innerText);
        console.log('Product Rating:', rating);
        await browser.close();
    })();