Scale your browser automation with pooled sessions that handle concurrency, health checks, and automatic recovery.Documentation Index
Fetch the complete documentation index at: https://docs.driver.dev/llms.txt
Use this file to discover all available pages before exploring further.
Installation
The
@browsercash/pool package requires playwright-core as a peer
dependency.Quick Start
TypeScript
Pool Options
Configure the pool behavior with these options:| Option | Type | Default | Description |
|---|---|---|---|
apiKey | string | Required | Your Driver API key |
chromium | ChromiumModule | Required | Playwright chromium instance |
size | number | 1 | Number of concurrent sessions to maintain |
maxUses | number | 50 | Maximum requests per session before recycling |
maxAgeMs | number | 300000 | Maximum session lifetime in milliseconds (5 min) |
enableHealthCheck | boolean | false | Enable background health monitoring |
healthCheckIntervalMs | number | 30000 | Health check frequency in milliseconds |
enableWaitQueue | boolean | true | Queue requests when all sessions are busy |
debug | boolean | false | Enable verbose logging |
Configuration Examples
High-Throughput Pool
TypeScript
Long-Running Pool with Health Checks
TypeScript
Pool Methods
init()
Initialize the pool and create the initial sessions:TypeScript
acquire()
Get an available session from the pool. If all sessions are busy andenableWaitQueue is true, the request will wait:
TypeScript
release(session)
Return a session to the pool for reuse:TypeScript
shutdown()
Gracefully close all sessions and clean up resources:TypeScript
Parallel Processing Example
Process multiple URLs concurrently using the pool:TypeScript
Next Steps
- Creating a Browser Session — Single session API reference
- Managing Sessions — Session lifecycle and cleanup
- Playwright Integration — Framework-specific examples