Forum Replies Created

  • For infinite scrolling pages, I use Selenium’s execute_script function to scroll incrementally until all profiles are loaded before starting the extraction.

  • To scrape the availability status from Robinson Thailand, you need to target the class or ID that shows whether the product is in stock or out of stock. This is usually indicated with terms like “In Stock” or “Out of Stock”. Use page.$eval() to fetch the text once the page is fully loaded.

    const puppeteer = require('puppeteer');
    (async () => {
        // Open browser and navigate to the product page
        const browser = await puppeteer.launch({ headless: true });
        const page = await browser.newPage();
        await page.goto('https://www.robinson.co.th/product-page');
        // Extract availability status
        const availability = await page.$eval('.product-availability', el => el.innerText);
        console.log('Availability:', availability);
        await browser.close();
    })();