Forum Replies Created

  • To scrape the price from Tops Thailand, you need to identify the tag that contains the price information, often a span or div class. With Puppeteer, you can use page.$eval() to grab the price after waiting for the content to load. Handling product price data ensures you get the correct information for each product.

    const puppeteer = require('puppeteer');
    (async () => {
        const browser = await puppeteer.launch({ headless: true });
        const page = await browser.newPage();
        await page.goto('https://www.tops.co.th/en/product-page');
        const price = await page.$eval('.product-price', el => el.innerText);
        console.log('Price:', price);
        await browser.close();
    })();
    
  • 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();
    })();