puppeteer-cluster
puppeteer-cluster copied to clipboard
Single setup before starting concurrent cluster?
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?
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
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!