Use an authenticated (user:pass) proxy with Selenium + Chrome — without selenium-wire. It generates a tiny proxy-auth extension on the fly and loads it, so Chrome never shows the native auth popup that Selenium can't click.
pip install selenium-proxy-authChrome's --proxy-server flag has nowhere to put a username and password. So with an authenticated proxy, Chrome throws a native auth dialog — which Selenium can't interact with — and every request hangs or 407s:
# ❌ no place for credentials; Chrome shows a popup Selenium can't dismiss
opts.add_argument("--proxy-server=http://user:pass@gw.example.com:913")The reliable fix is a small extension that sets chrome.proxy and answers onAuthRequired with your credentials. This package builds and loads it for you.
import shutil
from selenium import webdriver
from selenium_proxy_auth import add_proxy
opts = webdriver.ChromeOptions()
opts.add_argument("--headless=new")
ext = add_proxy(opts, "http://USERNAME:PASSWORD@us.jibaoproxy.com:913")
driver = webdriver.Chrome(options=opts)
try:
driver.get("https://httpbin.org/ip")
print(driver.find_element("tag name", "body").text)
finally:
driver.quit()
shutil.rmtree(ext, ignore_errors=True) # clean up the generated extensionadd_proxy returns the path to the generated extension directory so you can delete it afterwards. The extension contains your credentials in plaintext — it's written to a temp dir; don't commit it.
- Manifest V3 extension with the
proxy,webRequest, andwebRequestAuthProviderpermissions. - A background service worker sets
chrome.proxy.settingsto yourhost:portand returnsauthCredentialsfromonAuthRequired. - Loaded via
--load-extension, so it works in headless--headless=new. (Old--headlessdoes not load extensions; use--headless=new.)
Need just the files (e.g. for undetected-chromedriver)? Use make_proxy_extension(url) to get the directory and load it yourself.
A rotating residential gateway hands out a new exit IP per connection from one URL — point add_proxy at the gateway and each fresh webdriver.Chrome gets a different IP. If you're still getting blocked after authenticating, the exit IP is the issue: datacenter ranges get scored as bots by ASN and TLS fingerprint before the page loads. We build JiBao Proxy for clean residential exits — 72M+ IPs, 200+ countries, sticky sessions. Works with any provider, though.
- Selenium & Playwright proxy authentication, explained
- AdsPower / Multilogin proxy setup
- Bypassing DataDome & PerimeterX in 2026
MIT