Selenium WebDriver and authenticated proxies: what works

Updated:

Selenium proxy authentication needs a workaround, because ChromeDriver's --proxy-server=http://ip:port flag cannot carry a username and password; Chrome drops inline user:pass and shows a login dialog that WebDriver cannot fill. The two dependable fixes are selenium-wire, which handles the ProxyV4 login in Python, and a small Chrome extension that answers onAuthRequired in any Selenium language.

Selenium · HTTP Proxy Format
http://user:pass@ip:port (selenium-wire / Chrome proxy extension)

Options compared

MethodHow you configure itGood fit
selenium-wire (Python)seleniumwire_options={'proxy': {'http': 'http://user:pass@ip:port', 'https': 'http://user:pass@ip:port'}}Quickest route in Python; the proxy can be changed while the browser is open
Auth extensionA zipped extension whose background script handles chrome.webRequest.onAuthRequiredJava, C#, Python and undetected-chromedriver alike
Move to Playwrightbrowser.newContext({ proxy: { server, username, password } })New projects; proxy login is built in, no extension

What happens with plain --proxy-server

Chrome takes the proxy address from the command line but ignores any credentials written into it. When the proxy replies 407, Chrome opens a native sign-in prompt. That prompt is outside the page DOM, so find_element cannot see it and the script waits until it times out. Every working method therefore supplies the credentials somewhere other than the flag.

Note that selenium-wire is no longer actively maintained. It still works for many setups, but for long-lived projects the extension approach or Playwright is the safer bet.

Keeping proxied Selenium runs efficient

  • Set options.page_load_strategy = 'eager' so the script continues once the DOM is ready rather than waiting on slow third-party scripts
  • For headless runs on Chrome 109 or later use --headless=new; extensions, including the auth extension, behave as in a normal window
  • Turn off image loading in Chrome preferences when you only need text such as prices or titles
  • Put driver.quit() in a try / finally block so a crash does not leave Chrome processes behind

Before you scale up

Each WebDriver session is a full browser, so give every session its own IP if the site links accounts by address. A ProxyV4 private IPv4 is rented to one customer and keeps its address when you renew, which keeps long-running test accounts on the same IP. Run new proxies through the proxy checker first so a bad line does not show up as a confusing Selenium timeout.

Step by step

  1. 1

    Install selenium-wire

    In your virtual environment, run pip install selenium-wire.

  2. 2

    Describe the proxy

    Build sw_options = {'proxy': {'http': 'http://user:pass@ip:port', 'https': 'http://user:pass@ip:port'}} from your ProxyV4 order.

  3. 3

    Start Chrome with those options

    Create the driver with driver = webdriver.Chrome(seleniumwire_options=sw_options), importing webdriver from seleniumwire.

  4. 4

    Check the exit IP

    Call driver.get('https://proxyv4.com/api/my-ip') and confirm the page shows the proxy address.

Frequently asked questions

Why is `--proxy-server=http://user:pass@ip:port` ignored in ChromeOptions?

Chrome removes credentials from the --proxy-server value by design. Supply them through selenium-wire, an onAuthRequired extension, or switch to Playwright, which accepts a username and password directly.

Can selenium-wire change proxy without restarting the browser?

Yes. Assign a new dict, driver.proxy = {'http': 'http://...', 'https': 'http://...'}, and the following requests use the new upstream proxy.

Does the auth extension work in headless Chrome?

Yes, with --headless=new. The old --headless mode did not load extensions the same way.

Selenium times out on every page through the proxy. What next?

Load the IP endpoint with cURL using the same credentials. If cURL fails too, the line or port is the problem; the proxy timeout guide lists what to check.

Stable IPs for Selenium sessions

Private IPv4 in 7 countries and static ISP in the US and Vietnam, with user and password, unmetered and one customer per IP.

Check live US prices

Related articles

Proxies by platform
Proxies for web scraping: a fixed pool of IPs with unmetered traffic
Web scraping proxies for Python, Scrapy, Playwright and Selenium: a pool of private IPv4 and static ISP addresses, unlimited bandwidth, flat per-IP pricing.
Proxy setup
Playwright proxy authentication, one static IP per context
Give each Playwright browser context its own authenticated HTTP(S) proxy in Node.js or Python, match timezone and locale to the IP and confirm the exit address.
Proxy setup
Python requests through an authenticated proxy, step by step
Send Python requests through an authenticated HTTP(S) proxy: build the proxies dict, attach it to a Session, encode odd passwords, rotate a list, check the IP.
Proxy setup
Puppeteer with an authenticated proxy: launch flag plus login
Point Puppeteer at an HTTP(S) proxy with --proxy-server, log in with page.authenticate() on every tab, and run several IPs in one Chrome via browser contexts.
Proxies by platform
Proxies for SEO rank tracking: see the results page a local searcher sees
SEO rank tracking proxies with a private IPv4 in the US, UK, Vietnam, Japan and four more markets, so rankings, local packs and ads match what locals see.
Proxies by platform
Amazon seller proxies that give each account a permanent address
Amazon seller proxies for Seller Central, KDP and Merch: a US static ISP or UK/Japan private IPv4 per account, rented to you alone and kept on renewal.
IPV4 · united states
Build a US IP Pool for Scraping, Rank Tracking and Ad Checks
Buy US private IPv4 proxies: static American datacenter IPs, one customer per IP, unlimited bandwidth. Built for scraping, SERP tracking and US ad checks.
ISP · united states
A Home-Registered US IP That Never Changes and Is Yours Alone
US static ISP proxies on IPs registered to consumer internet providers. One fixed American IP per account for Amazon sellers, ad accounts and Instagram.