-
How can I scrape product name, price, and rating from Klook Thailand -Puppeteer?
To scrape the product name from Klook Thailand, you can use Puppeteer to navigate to the product page and target the HTML element that contains the product name. The name is typically stored within an h1 or span tag with a specific class. You’ll need to ensure that the page is fully loaded using waitForSelector() before extracting the text.
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 productName = await page.$eval('.activity-title', el => el.innerText); console.log('Product Name:', productName); await browser.close(); })();
Log in to reply.