News Feed Forums General Web Scraping How can I scrape product name, price, and rating from Klook Thailand -Puppeteer? Reply To: How can I scrape product name, price, and rating from Klook Thailand -Puppeteer?

  • Coronis Osmond

    Member
    12/12/2024 at 10:18 am

    To scrape the price from Klook Thailand, use Puppeteer to extract the price information, which is usually found inside a span or div element with a class related to pricing. After navigating to the product page, wait for the price element to be visible, then extract it using page.$eval().

    const puppeteer = require('puppeteer');
    (async () => {
        const browser = await puppeteer.launch({ headless: true });
        const page = await browser.newPage();
        await page.goto('https://www.klook.com/en-TH/activity/');
        const price = await page.$eval('.price', el => el.innerText);
        console.log('Price:', price);
        await browser.close();
    })();