How To Passing Multiple Data in Puppeteer-Cluster

Just one question. How can i do this?
I have these data :
url :
and 2 string data, example : firstName and lastName

The url is still the same in every browser, but, firstName and lastName will be changed every browser (firstName1 lastName1 for browser1, firstName2 lastName2 for browser2 and so on)

How I can pass these data from cluster.queue to cluster.task?


Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

If you have more than one data then you can pass it as an array or object.

const { Cluster } = require('puppeteer-cluster');

(async () => {
  const cluster = await Cluster.launch({
    concurrency: Cluster.CONCURRENCY_CONTEXT,
    maxConcurrency: 2,

  await cluster.task(async ({ page, data: {username, password} }) => {
    await page.goto(url);
    const screen = await page.screenshot();
    // Store screenshot, do something else

  cluster.queue({username: 'john.doe', password: '53CR37A63N7!'});
  cluster.queue({username: 'mr.bean', password: 'JohnyEnglish1234'});
  // many more pages

  await cluster.idle();
  await cluster.close();

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x