Skip to content
Browser automation

How to use proxies with Selenium

Selenium routes traffic through a proxy via browser options — a --proxy-server argument for Chrome or a configured Proxy object. Chrome ignores credentials in that flag, so authenticated proxies need either IP whitelisting or a small extension that answers the auth challenge.

Recommended for Selenium

ISP proxies Selenium is often used for logged-in account work, which needs one stable, trusted IP rather than a rotating pool — and IP whitelisting avoids the Chrome authentication problem entirely.

See isp proxies

Setup

  1. 1

    Install Selenium

    Install the bindings; recent versions manage the driver binary for you.

    pip install selenium
  2. 2

    Set the proxy on Chrome

    Add the proxy as a Chrome argument. This works directly when your machine's IP is whitelisted in the dashboard, because no credentials are then required. Replace PROXY_HOST, PROXY_PORT, USERNAME and PASSWORD with the endpoint and credentials shown in your seamless dashboard.

    from selenium import webdriver
    
    options = webdriver.ChromeOptions()
    options.add_argument("--proxy-server=http://PROXY_HOST:PROXY_PORT")
    
    driver = webdriver.Chrome(options=options)
    driver.get("https://example.com")
  3. 3

    Handle username and password authentication

    Chrome ignores credentials in --proxy-server and shows a native dialog Selenium cannot dismiss. Whitelisting your IP is the simplest fix; if that is not possible, load a small extension that supplies the credentials.

    # Firefox can be scripted directly, unlike Chrome
    from selenium import webdriver
    
    profile = webdriver.FirefoxProfile()
    profile.set_preference("network.proxy.type", 1)
    profile.set_preference("network.proxy.http", "PROXY_HOST")
    profile.set_preference("network.proxy.http_port", PROXY_PORT)
    profile.set_preference("network.proxy.ssl", "PROXY_HOST")
    profile.set_preference("network.proxy.ssl_port", PROXY_PORT)
    profile.update_preferences()
    
    driver = webdriver.Firefox(firefox_profile=profile)
  4. 4

    Verify the exit IP

    Confirm the browser is really going through the proxy before you build anything on top of it.

    driver.get("https://api.ipify.org?format=json")
    print(driver.page_source)

Selenium proxy FAQ

How do I use an authenticated proxy in Selenium with Chrome?

Chrome ignores credentials placed in the --proxy-server flag and raises a native authentication dialog that WebDriver cannot interact with. The two workable approaches are whitelisting your machine's IP so no credentials are needed, or packaging a small Chrome extension that responds to the authentication request.

Does Selenium support SOCKS5 proxies?

Yes. Chrome accepts --proxy-server=socks5://host:port, and Firefox can be pointed at a SOCKS proxy through the network.proxy.socks preferences.

Should I use Selenium or Playwright with proxies?

Playwright handles proxy authentication natively and supports a different proxy per browser context, which makes it markedly less awkward for proxy work. Selenium remains the pragmatic choice when you already have an established suite built on it.