How to loop through multiple pages with Playwright
How to loop through multiple pages and urls with Playwright
From Playwright.dev
const { chromium } = require('playwright'); // Or 'firefox' or 'webkit'.
(async () => {
const browser = await chromium.launch();
const page = await browser.newPage();
for (let currentURL of ['https://google.com', 'https://bbc.com']) {
await page.goto(currentURL);
const element = await page.waitForSelector('img');
console.log('Loaded image: ' + await element.getAttribute('src'));
}
await browser.close();
})();
Next: Measure LCP on multiple urls in Playwright
Previous: 404 check, check for broken links and see redirect chain