Forum Replies Created

  • To scrape the price from Robinson Thailand, you’ll need to locate the element that contains the price, which is often within a span or div. Puppeteer allows you to wait for the page to load and then extract the price using page.$eval(). Be aware that the price might include currency symbols or formatting.

    const puppeteer = require('puppeteer');
    (async () => {
        // Launch browser
        const browser = await puppeteer.launch({ headless: true });
        const page = await browser.newPage();
        await page.goto('https://www.robinson.co.th/product-page');
        // Scrape price from the page
        const price = await page.$eval('.product-price', el => el.innerText);
        console.log('Price:', price);
        // Close the browser
        await browser.close();
    })();
    
  • Scraping the price from HomePro Thailand involves targeting the HTML element containing the product’s price, which is typically inside a span or div with a price-related class. After waiting for the page to load, you can extract the price text using Puppeteer’s page.$eval() method. The price will often include the currency symbol and might be formatted with thousands separators.

    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 price = await page.$eval('.product-price', el => el.innerText);
        console.log('Price:', price);
        await browser.close();
    })();