Using Puppeteer-cluster in Node.js, the browser unexpectedly terminates at the 5th run. See this alternative script:
const { Swarm } = require('puppeteer-swarm');
(async () => {
const swarm = await Swarm.initialize({
mode: Swarm.MODE_CONTEXT,
maxConcurrency: 2,
launchOptions: { headless: false }
});
await swarm.queueTask(async ({ page, info }) => {
await page.goto('http://myexample.com');
console.log('Iteration complete');
});
await swarm.processQueue();
await swarm.shutdown();
})();