import { firefox,chromium } from 'playwright'; async function run({ name, country_id }) { const browser = await chromium.launch({ // executablePath: '/var/www/firefox/firefox', headless: true }); const page = await browser.newPage(); // Navigate to the page await page.goto('https://firetitle.net/title-builder/index.php'); // Fill in input fields await page.fill('[name="search_value"]', name); await page.locator('label[for="choose-'+ country_id +'"]').click(); await page.locator('[name="search"]').click(); await page.waitForSelector('.keyword'); // Retrieve all elements with the '.keyword' class const elements = await page.$$('.keyword'); // Log the number of elements found {{-- console.log(`Found ${elements.length} elements with the class '.keyword'`); --}} // Extract text or any other content from the elements for (const element of elements) { const textContent = await element.innerText(); if(textContent) console.log(textContent); // or process the text content } await browser.close(); } // Example usage run({ name: "{{ $search_term }}", country_id: '{{ $country_id }}' });