Prompt

How do I assign different proxies to different browser sessions?

Latest observation

Jul 15, 2026 · OpenAI APIWeb search: off

To assign different proxies to different browser sessions, the exact method depends on which browser automation tool you’re using. In general, the idea is:

  • Create a separate browser context/profile/session
  • Launch each session with its own proxy settings
  • Avoid sharing cookies/cache if you want sessions isolated

Here are the common approaches:


1) Selenium

With Selenium, you usually set the proxy per browser instance, not per tab.

Python example

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

def make_driver(proxy):
    options = Options()
    options.add_argument(f'--proxy-server={proxy}')
    return webdriver.Chrome(options=options)

driver1 = make_driver("http://proxy1.example.com:8080")
driver2 = make_driver("http://proxy2.example.com:8080")

driver1.get("https://example.com")
driver2.get("https://example.com")

Notes

  • Each webdriver.Chrome() call is a separate session.
  • If the proxy requires auth, Selenium alone is awkward; you may need:
    • a proxy extension,
    • a local proxy wrapper,
    • or tools like selenium-wire.

2) Playwright

Playwright supports proxies nicely, and the proxy is typically set when you create a browser context or browser.

Python example

from playwright.sync_api import sync_playwright

with sync_playwright() as p:
    browser = p.chromium.launch()

    context1 = browser.new_context(proxy={
        "server": "http://proxy1.example.com:8080"
    })
    page1 = context1.new_page()

    context2 = browser.new_context(proxy={
        "server": "http://proxy2.example.com:8080"
    })
    page2 = context2.new_page()

    page1.goto("https://example.com")
    page2.goto("https://example.com")

Notes

  • Playwright contexts are isolated, which is great for separate sessions.
  • Depending on the version and browser, proxy support is often easiest by launching separate browser instances if you run into limitations.

3) Puppeteer

Puppeteer usually sets proxy at browser launch.

Example

const browser1 = await puppeteer.launch({
  args: ['--proxy-server=http://proxy1.example.com:8080']
});

const browser2 = await puppeteer.launch({
  args: ['--proxy-server=http://proxy2.example.com:8080']
});

Notes

  • For different proxies, you generally need different browser instances.
  • Separate incognito contexts do not always let you set different proxies unless using additional tooling or launching separate browsers.

4) Chrome profiles manually

If you’re using regular Chrome, you can assign proxies via:

  • browser launch flags,
  • OS-level proxy settings,
  • or separate profiles with different startup shortcuts.

Example shortcut flags:

chrome --user-data-dir="/tmp/profile1" --proxy-server="http://proxy1.example.com:8080"
chrome --user-data-dir="/tmp/profile2" --proxy-server="http://proxy2.example.com:8080"

This gives you two isolated browser profiles with different proxies.


5) If you need many rotating proxies

If you’re managing many sessions, consider:

  • Playwright/Selenium with one browser instance per proxy
  • a proxy pool
  • a session manager that maps session IDs to proxies
  • a tool like Browserless, Multilogin, GoLogin, or Incogniton for persistent isolated profiles

Important caveats

  • One browser session = one proxy is usually easiest.
  • A proxy is often applied at launch time, not dynamically per page.
  • Switching proxies mid-session can break cookies, authentication, or fingerprints.
  • If your proxies use username/password auth, the setup differs.

If you tell me which stack you’re using (Selenium, Playwright, Puppeteer, Chrome, Firefox, Node.js, Python, etc.), I can give you an exact working example.

Observation history

Unlock observation history

Create a free Obsurfable account to unlock historical responses, model comparisons, and deeper brand intelligence.

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, and Meta AI.