Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Selenium Proxy Authentication in Python (the way that actually works)

Selenium + Chrome cannot do proxy auth natively--proxy-server ignores credentials and Chrome pops a login dialog Selenium can't touch. Here are the two reliable patterns.

Option A — selenium-wire (simplest)

selenium-wire intercepts traffic in a local MITM layer and handles upstream auth for you:

pip install selenium-wire selenium
from seleniumwire import webdriver

options = {
    "proxy": {
        "http":  "http://USER-country-us-session-sel1-lifetime-30:PASS@residentialboson.quantumproxies.io:10000",
        "https": "http://USER-country-us-session-sel1-lifetime-30:PASS@residentialboson.quantumproxies.io:10000",
    }
}

driver = webdriver.Chrome(seleniumwire_options=options)
driver.get("https://ipinfo.io/json")
print(driver.find_element("tag name", "body").text)
driver.quit()

Option B — Chrome extension shim (no MITM)

Generate a tiny MV3 extension at runtime that answers the auth challenge via chrome.webRequest.onAuthRequired, and load it with --load-extension. No traffic interception, works with vanilla Selenium. Full generator in selenium_proxy.py.

Which one?

selenium-wire extension shim
Setup one pip install ~40 lines, no extra deps
TLS re-signed locally (MITM) untouched
Headless ok needs --headless=new

Either way, use a sticky session (-session-…-lifetime-30, port 10000): a browser page load is dozens of requests and they must exit from one IP.

QP_USER=... QP_PASS=... python selenium_proxy.py

IPs supplied by QuantumProxies residential proxies — entry-priced residential pool, geo flags in the username, per-GB billing. Credentials: app.quantumproxies.io.

About

Selenium + Chrome proxy auth that actually works: selenium-wire or a runtime-generated MV3 extension.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages