puppeteer-cluster icon indicating copy to clipboard operation
puppeteer-cluster copied to clipboard

Single setup before starting concurrent cluster?

Open DawidOskwarek opened this issue 2 years ago • 2 comments

Hey, sorry if this was answered before.

Is there a way to perform a single action/function before starting a concurrent cluster? I want to be able to sign in to a website once, and then every concurrent page that I start in a cluster will not have to log in again. How would I go about it? Any examples out there?

DawidOskwarek avatar Jan 17 '23 14:01 DawidOskwarek

Depending on how the authentication is setup on the website (eg, if they support cookie sessions) if you run with the CONCURRENCY_PAGE setting then all other pages may be authorized after the first sign in

stoddabr avatar Feb 06 '23 17:02 stoddabr

As our dear friend replied above, using the concurrency: Cluster.CONCURRENCY_PAGE setting in the launch configuration, you can pass settings, cookies, localStorage from one browser to another, this way if the method of using the login whether by cookies, session, etc., this state will be passed on.

If not, you can create a Login class where it performs the steps to login, usually sites with login show when you are logged in, prefer to check if the user is logged in, if not, run this login steps function, then continue. Hope this helps!

DanielXavierJob avatar Feb 22 '23 00:02 DanielXavierJob