For AI agents: a documentation index is available at /llms.txt
Skip to main content

Puppeteer Configurations

This page covers advanced Puppeteer configurations for users who have already established basic connections to Browserless. If you haven't set up a basic Puppeteer connection yet, start with our Quickstart guide.

Prerequisites

Here are some advanced configurations you can explore:

Advanced Monitoring and Debugging

CDP Performance Monitoring

Access Chrome DevTools Protocol to collect real-time browser performance metrics through direct CDP session communication:

const client = await page.target().createCDPSession();
await client.send('Performance.enable');

// Get performance metrics
const metrics = await client.send('Performance.getMetrics');
console.log('Performance metrics:', metrics);

Network Request Monitoring

Implement comprehensive network activity tracking through Puppeteer's event-driven request/response lifecycle monitoring:

page.on('request', request => {
console.log('→', request.method(), request.url());
});

page.on('response', response => {
// Check if response indicates a non-success status (outside 200-299)
if (!response.ok()) {
console.log('✗', response.status(), response.url());
}
});

page.on('requestfailed', request => {
// Log network-level failures: timeouts, DNS errors, connection refused
console.log('✗ Failed:', request.url(), request.failure().errorText);
});

Performance Optimization

Package Optimization

Switch to puppeteer-core for production deployments to reduce bundle size:

npm install puppeteer-core

For comprehensive performance optimization techniques including network round-trip reduction and navigation settings, see our Best Practices guide.

Advanced Launch Configuration

For complex Chrome flags and launch parameters using the JSON launch parameter approach, see the Launch parameters documentation.

Proxy Configuration and Cost Optimization

For comprehensive proxy configuration including residential proxies, geographic targeting, and bandwidth cost optimization, see Proxies Documentation.

Regional Optimization

For regional endpoint optimization and performance considerations, see Best Practices.

FAQ & Troubleshooting

Why am I getting a 403 Forbidden error?

Your API token is missing or expired. Pass it as a ?token= query parameter in the WebSocket or HTTP URL. Verify the token in your account dashboard.

My script works locally but fails on Browserless

Local browser settings may differ from the Browserless environment. Use launch parameters to match your local setup (viewport, user agent, timezone). See launch parameters for the full list.

Next steps