Skip to main content

Closing a session

Always close the session when your automation is done to free up cloud resources and avoid hitting concurrency limits.
Puppeteer
Playwright

Reusing a session across multiple operations

Each puppeteer.connect() or connect_over_cdp() call starts a new session. If you run multiple operations sequentially (for example, in an agent workflow), reuse the same connection — otherwise cookies, local storage, and page state are lost between steps. Recommended pattern — session singleton:
Puppeteer
Playwright

Handling disconnects

Network interruptions or cloud-side timeouts can drop the connection. Check connectivity before each operation and reconnect if needed:
Puppeteer

Concurrency

Each active session counts against your plan’s concurrency limit. To avoid errors:
  • close sessions when done
  • do not connect to the same profile from multiple processes simultaneously
See rate limits: https://gologin.com/docs/api-reference/limitations/rate-limits