browser

Browser Context

A browser context is an isolated browser session within a single browser process, with separate cookies, cache, and storage — enabling parallel scraping without session cross-contamination.

In Playwright and Puppeteer, a browser context is a lightweight container that mimics an incognito window: it shares the browser process and network stack but maintains completely separate cookies, local storage, IndexedDB, and authentication state. Multiple contexts can run concurrently inside a single browser, each acting as an independent user session.

Browser contexts are the preferred unit of isolation for parallel scraping tasks. Creating a new context is orders of magnitude cheaper than launching a new browser instance, allowing a single browser process to handle many simultaneous scraping sessions efficiently. Each context can also have distinct viewport dimensions, locale settings, geolocation overrides, and HTTP authentication credentials.

For anti-bot evasion, each context should be treated as a distinct user: avoid sharing cookies or storage between contexts, and apply consistent fingerprint settings within a context (same user agent, viewport, timezone) so that the fingerprint remains coherent across a session.

Examples

// Playwright: create isolated browser contexts for parallel scraping
const browser = await chromium.launch();
const contexts = await Promise.all(
  urls.map(async (url) => {
    const ctx = await browser.newContext({ locale: "en-US" });
    const page = await ctx.newPage();
    await page.goto(url);
    return page.content();
  })
);
await browser.close();

Related Terms

Extract Browser Context data from any website

AlterLab returns clean, structured data from any public URL — no scraper infrastructure needed. Start free, no credit card required.

View API docs

Your first scrape.
Sixty seconds.

$1 free balance. No credit card. No SDK.Just a POST request.

terminal
curl -X POST https://api.alterlab.io/v1/scrape \
-H "X-API-Key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com", "formats": ["markdown"]}'

No credit card required · Up to 5,000 free scrapes · Balance never expires

    Browser Context — Web Scraping Glossary | AlterLab