Puppeteer Scraper Browser: Headless Chrome Automation
Puppeteer is the Google Chrome team's official Node.js library for headless browser automation. Learn how to launch Headless Chrome with stealth options, optimize memory consumption, and connect Puppeteer to remote cloud scraper browsers.
2Captcha Browser API
Connects to puppeteer-core in one line. Completely eliminates the need to install 300MB Chromium binaries on your server.
import puppeteer from 'puppeteer-core';
// Connect puppeteer-core to remote 2Captcha scraper browser
const endpoint = 'wss://browser.2captcha.com/?apiKey=YOUR_API_KEY&country=us';
async function main() {
const browser = await puppeteer.connect({ browserWSEndpoint: endpoint });
const page = await browser.newPage();
await page.goto('https://quotes.toscrape.com', { waitUntil: 'networkidle2' });
console.log('Title:', await page.title());
await browser.close();
}
main();Puppeteer vs Puppeteer-Core: What's the Difference?
The standard `puppeteer` package downloads a bundled ~300MB Chromium binary during npm install. `puppeteer-core` is a lightweight alternative that does not download Chromium; it connects to an existing local Chrome browser or a remote cloud browser API like 2Captcha.
Configuring Puppeteer Launch Headless Mode
When running locally, always pass `headless: 'new'` in Puppeteer launch options: `puppeteer.launch({ headless: 'new', args: ['--no-sandbox', '--disable-setuid-sandbox'] })`. This ensures Puppeteer uses Google Chrome's modern rendering engine.
Why Puppeteer Scripts Get Detected and Blocked
Puppeteer scripts leak automation signatures through navigator.webdriver, CDP runtime bindings, and missing WebRTC/WebGL hardware noise. Connecting puppeteer-core to 2Captcha Browser API bypasses these checks at the protocol layer.
Architectural Benchmark & Pricing Comparison
| Setup | Package Size | Ram Usage | Anti Bot |
|---|---|---|---|
| puppeteer (Local Binary) | ~320 MB | 300MB+ / tab | Requires extra plugins |
| puppeteer-core + 2Captcha (#1) | ~5 MB | Under 25MB | Native Automated (99.4%) |
Frequently Asked Questions
How do I run Puppeteer with Google Chrome instead of Chromium?
Set executablePath in puppeteer.launch() to your local Chrome path (e.g., C:\Program Files\Google\Chrome\Application\chrome.exe on Windows or /usr/bin/google-chrome on Linux).
Why does Puppeteer crash in Docker?
Docker defaults to 64MB shared memory (/dev/shm). Pass '--disable-dev-shm-usage' in launch args or run Docker with '--shm-size=1gb'.
Launch Managed Cloud Headless Chrome in Seconds
Get instant access to genuine Chrome DevTools Protocol endpoints, automated CAPTCHA clearing, and residential proxies in 220+ countries.