Appearance
Usage
Minimal Usage Example: Puppeteer with rebrowser-puppeteer-core
After installing the drop-in replacement packages (see Install), use rebrowser-puppeteer-core exactly like puppeteer-core. The patches apply transparently.
javascript
import puppeteer from 'rebrowser-puppeteer-core'
const browser = await puppeteer.launch({
executablePath: '/path/to/chrome', // or use the Rebrowser cloud CDP endpoint
headless: true,
})
const page = await browser.newPage()
await page.goto('https://example.com')
const title = await page.title()
console.log('Page title:', title)
await browser.close()Using rebrowser-patches with puppeteer-extra
If you use puppeteer-extra plugins, wrap rebrowser-puppeteer-core with addExtra:
javascript
import { addExtra } from 'puppeteer-extra'
import rebrowserPuppeteer from 'rebrowser-puppeteer-core'
const puppeteer = addExtra(rebrowserPuppeteer)
// attach your puppeteer-extra plugins here, then launch as normal
const browser = await puppeteer.launch({ headless: true })Environment Variable Controls
These environment variables tune the Runtime.Enable fix mode and debugging without code changes:
| Variable | Values | Effect |
|---|---|---|
REBROWSER_PATCHES_RUNTIME_FIX_MODE | addBinding (default), alwaysIsolated, enableDisable, 0 | Controls the CDP Runtime.Enable detection fix strategy |
REBROWSER_PATCHES_SOURCE_URL | e.g. jquery.min.js | Overrides injected script source URL identifier |
REBROWSER_PATCHES_UTILITY_WORLD_NAME | e.g. customUtilityWorld | Customizes the isolation context name |
REBROWSER_PATCHES_DEBUG | 1 | Enables verbose debug logging |
Example:
bash
REBROWSER_PATCHES_DEBUG=1 REBROWSER_PATCHES_RUNTIME_FIX_MODE=alwaysIsolated node script.jsCloud Platform: Connecting via CDP Endpoint
Replace puppeteer.launch() with a puppeteer.connect() call pointing at your Rebrowser profile's remote CDP URL:
javascript
import puppeteer from 'rebrowser-puppeteer-core'
const browser = await puppeteer.connect({
browserWSEndpoint: 'wss://api.rebrowser.net/YOUR_PROFILE_ID?apiKey=YOUR_API_KEY',
})
const page = await browser.newPage()
await page.goto('https://example.com')
console.log(await page.title())
await browser.close()Replace YOUR_PROFILE_ID and YOUR_API_KEY with values from your Rebrowser dashboard. No local Chrome binary needed.
Important Caveats
- Patches address the
Runtime.EnableCDP leak but do not guarantee full undetectability on their own. Pair with appropriate proxies, realistic user-agent strings, and canvas/WebGL fingerprint spoofing for production use. page.pause()is incompatible with the runtime fix when enabled in Playwright.- Re-run the patcher after any
npm installoryarn installthat updates the patched package, as the package manager may overwrite the patched files. - Playwright support is Chrome-only; WebKit and Firefox support is pending.