Skip to content

Selenium Proxy with Authentication: Username and Password in Chrome

Chrome ignores user:pass in proxy settings. Selenium's BiDi auth handler answers the proxy's password prompt for you.

Why Selenium proxies need one extra step

Selenium grids and CI runners send every browser session from the machine's own IP. Run enough sessions and a site rate-limits that one address with HTTP 429 Too Many Requests, and geo-dependent tests only ever see the country the runner sits in.

Selenium sets a proxy through browser options, but Chrome takes only host and port from them: it won't use credentials embedded in proxy settings and supports no authentication method for SOCKS5. A proxy with a password therefore needs something to answer its 407 challenge.

Selenium has that built in. With WebDriver BiDi enabled, driver.network.add_auth_handler(username, password) answers authentication challenges — the proxy's included, in our test. One catch we hit with ChromeDriver 153: a classic driver.get() stalled while the proxy was asking for the password, while navigating with browsing_context.navigate worked, and later driver.get() calls reused the credentials. A second catch: Selenium also hands a proxy set through options.proxy to Selenium Manager, which then tries to download ChromeDriver through it without the password — so the code passes the proxy as a Chrome flag instead.

Recommended Selenium setup

Scroll horizontally with the arrow keys to read all content.

Recommended Selenium setup
CriterionChooseWhy
ProductStatic datacenter proxyFastest and cheapest per IP, fixed for the whole term — fits regression runs, grids and CI
If the site blocks serversRotating residential, Budget lineReal household IPs from US$1.50/GB, billed per GB
How many IPsOne per parallel session or grid nodeSessions stop sharing one address and one rate limit
CountryThe market your test covers: US, CA, GB, DE, NL, JP, KR or SG for datacenterLocation-dependent pages render per country
ProtocolHTTPChrome can't authenticate to SOCKS5
Where to set itA --proxy-server flag in ChromeOptionsoptions.proxy would also send Selenium Manager's ChromeDriver download through the proxy, without the password
AuthenticationSelenium's BiDi auth handlerBuilt into Selenium 4; nothing extra to install or keep compatible

The button below opens Static Datacenter Proxies with the AI and automation use case. Choose Region, Term, Protocol and Quantity (up to 100 IPs at a time) before you pay.

Which Proxy302 proxy to buy

Scroll horizontally with the arrow keys to read all content.

Which Proxy302 proxy to buy
CriterionStatic ISPRotating residentialDatacenter
What you getA dedicated home-broadband IP that stays yours for the whole termReal household IPs: rotating exits, or a sticky session in a chosen country or cityFast fixed server IPs, HTTP and SOCKS5
PricePer IP and term — live price at checkoutBudget US$1.50/GB (US$1.35/GB at 100 GB); Premium US$5.00/GBPer IP and term — the cheapest per IP
Best for SeleniumLong logged-in test journeys on one IPTesting or scraping sites that block server IPsRegression runs, grids and CI

Prices in US dollars. Top up your wallet once and pay any line from it. Nothing renews automatically — renew in My assets to keep an IP.

Set up Selenium proxies in 5 steps

  1. Choose the region and term

    The button below opens Static Datacenter Proxies (Per IP and term) with the AI and automation use case. Under Connection settings pick the Region, choose a Term and set Protocol to HTTP. Set Quantity to the number of IPs you need (one for each parallel session, up to 100 at a time). Then click Review cost and generate.

  2. Copy each IP

    In My assets, Copy gives host:port:user:password. Put host and port in PROXY_HOST and PROXY_PORT, user and password in PROXY_USER and PROXY_PASS.

  3. Set the proxy and the auth handler

    In ChromeOptions set enable_bidi = True and add the argument --proxy-server=http://host:port, with no user or password in it. After the driver starts, call driver.network.add_auth_handler(user, password).

  4. Open the first page over BiDi

    Use driver.browsing_context.navigate(context=driver.current_window_handle, url=..., wait="complete") for the first page. After that, ordinary driver.get() works.

    Expected result api.ipify.org shows the proxy's IP, not your machine's.

  5. Run it on a grid or CI

    The browser connects to the proxy from the machine that runs it, so that node or runner needs outbound access to the proxy's port. Give each parallel session its own IP.

Selenium proxy with username and password (Python)

Scroll horizontally with the arrow keys to read all content.

# pip install -U selenium   (Selenium Manager fetches a matching ChromeDriver)
import os
from selenium import webdriver
from selenium.webdriver.common.by import By

# From Proxy302 → My assets → Copy (host:port:user:password); use the HTTP endpoint
endpoint = f"{os.environ['PROXY_HOST']}:{os.environ['PROXY_PORT']}"

options = webdriver.ChromeOptions()
options.enable_bidi = True  # the auth handler below runs over WebDriver BiDi
# A Chrome flag, not options.proxy: Selenium Manager would fetch ChromeDriver through options.proxy, without the password
options.add_argument(f"--proxy-server=http://{endpoint}")

driver = webdriver.Chrome(options=options)
try:
    # Chrome ignores user:pass written into proxy settings, so answer the 407 challenge instead
    driver.network.add_auth_handler(os.environ["PROXY_USER"], os.environ["PROXY_PASS"])
    # Navigate over BiDi: a classic driver.get() can stall while the proxy challenge is pending
    driver.browsing_context.navigate(
        context=driver.current_window_handle,
        url="https://api.ipify.org?format=json",
        wait="complete",
    )
    print(driver.find_element(By.TAG_NAME, "body").text)  # the proxy's exit IP
finally:
    driver.quit()

Checked on 2026-10-18 with Selenium 4.41.0 and 4.51.0 and Chromium/ChromeDriver 153 through a local password-protected proxy, for an HTTP and an HTTPS page: the right password loaded the page, a wrong one loaded nothing, and on a first run Selenium Manager downloaded ChromeDriver without going through the proxy.

Quick fixes

driver.get() hangs, then 'Timed out receiving message from renderer'

Check Is the first navigation a classic driver.get() while the proxy is asking for a password?

Fix Register add_auth_handler first and open the first page with browsing_context.navigate(..., wait="complete"); later driver.get() calls reuse the credentials.

407, or the proxy is ignored

Check Is enable_bidi set before the driver starts? Did you put user:pass@ into --proxy-server?

Fix Set options.enable_bidi = True, give --proxy-server only http://host:port, and pass the user and password to add_auth_handler.

'WebDriver' object has no attribute 'network'

Check Which Selenium version is installed?

Fix Upgrade with pip install -U selenium; we checked 4.41.0 and 4.51.0.

'Unable to obtain driver for chrome' on the first run

Check Is the proxy set through options.proxy? Selenium Manager then tries to download ChromeDriver through it, without the password.

Fix Pass the proxy as a --proxy-server flag, as in the code above, or point Service('path/to/chromedriver') at a ChromeDriver you already have.

Selenium proxy FAQ

How do I use a proxy with username and password in Selenium?

Pass the proxy's host:port to Chrome with a --proxy-server flag in ChromeOptions, enable BiDi, call driver.network.add_auth_handler(user, password) and open the first page with browsing_context.navigate. The code above does exactly that.

Why doesn't user:pass@host:port work in Chrome's proxy settings?

Chrome doesn't use credentials embedded in proxy settings, and it supports no authentication for SOCKS5 proxies.

Do I need Selenium Wire or a proxy extension?

No. The auth handler is part of Selenium itself, so there's no extra package or extension to install and keep compatible.

Does it work on Selenium Grid?

The proxy is applied by the browser on the node, so the node needs outbound access to it. We ran the auth handler against a local ChromeDriver, not a Grid — test one session on your Grid first.

Why a --proxy-server flag instead of options.proxy?

Selenium passes options.proxy to Selenium Manager as well, and Selenium Manager downloads ChromeDriver through it — without the password, so a first run fails with a 407. Setting SE_PROXY doesn't help, because the proxy from your options takes precedence. A --proxy-server flag reaches only Chrome, so the driver download goes direct.

Residential or datacenter for Selenium?

Datacenter when the site accepts server IPs — fastest and cheapest per IP. Rotating residential when the site blocks or keeps challenging server IPs.

Sources and verification

9
  1. Selenium docs — Browser options: proxy

    Official documentation · Checked:

  2. Chromium — Proxy support in Chrome

    Official documentation · Checked:

  3. Selenium docs — WebDriver BiDi network: authentication handlers

    Official documentation · Checked:

  4. Selenium Python API — Network.add_auth_handler

    Official documentation · Checked:

  5. Selenium docs — Selenium Manager: proxy for driver downloads

    Official documentation · Checked:

  6. MDN — 429 Too Many Requests

    Official documentation · Checked:

  7. Proxy302 pricing

    Product observation · Checked:

    Rotating residential per-GB prices as published on the pricing page and used by the console (Budget US$1.50/GB, US$1.35/GB in the 100 GB package; Premium US$5.00/GB; 1 PTC = US$1). Static ISP and datacenter IPs are quoted live per IP and term.

  8. Proxy302 console — Static Datacenter Proxies

    Product observation · Checked:

    Option names, billing modes and limits as shown in the live console on 2026-10-18: Line (Premium/Budget), Exit mode, Region, State, City, Protocol (HTTP/SOCKS5), Quantity (1–500), Term, Auto-renew IP (not yet available), My assets → Copy / Rotate / Renew / Copy for AI. Rotating residential connects through proxy.proxy302.com:2222 (HTTP) and :3333 (SOCKS5). Static datacenter IPs were sold in 8 countries on 2026-10-18 (read-only check of the production catalogue): US, CA, GB, DE, NL, JP, KR, SG.

  9. Local proxy fixture run

    Local example · Checked:

    The code block was executed on 2026-10-18 against a local password-protected proxy that answers 407 without valid credentials, for an HTTP page and for an HTTPS page reached through a CONNECT tunnel; Selenium 4.41.0 and 4.51.0 with Chromium and ChromeDriver 153.0.8010.12. With the auth handler and a BiDi navigation the page loaded through the proxy; a wrong password loaded nothing. A classic driver.get() issued while the proxy challenge was pending stalled until the page-load timeout; after the first BiDi navigation had authenticated, later driver.get() calls worked. With an empty Selenium Manager cache, this version downloaded ChromeDriver directly and ran; the same script with options.proxy failed, because Selenium Manager sent its download through the proxy without the password.

    A local check proves the configuration syntax and authentication path, not access to any specific website, country or platform.

Ready to connect?

Create an account, top up once and pick rotating residential, static ISP or datacenter. Rotating residential exits cover 195+ countries and regions.