Skip to main content

selenium-proxy-auth

PyPI version Python versions License: MIT

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-auth

The problem

Chrome'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.

Usage

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 extension

add_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.

How it works

  • Manifest V3 extension with the proxy, webRequest, and webRequestAuthProvider permissions.
  • A background service worker sets chrome.proxy.settings to your host:port and returns authCredentials from onAuthRequired.
  • Loaded via --load-extension, so it works in headless --headless=new. (Old --headless does 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.

Rotating IPs

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.

License

MIT

Metadata

Release files for selenium-proxy-auth 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for selenium-proxy-auth 0.1.0
File Size Uploaded Provenance Actions
selenium_proxy_auth-0.1.0.tar.gz 5.2 kB Without provenance Details for selenium_proxy_auth-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for selenium-proxy-auth 0.1.0
File Interpreter ABI Platform Actions
selenium_proxy_auth-0.1.0-py3-none-any.whl Python 3 none any Details for selenium_proxy_auth-0.1.0-py3-none-any.whl

Total release size: 10.8 kB

Release files / selenium_proxy_auth-0.1.0.tar.gz

Download URL selenium_proxy_auth-0.1.0.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
784a61a3e21867e2ab8ab4bcfa317462689bb841c3620441d0c4de745ff49a08
BLAKE2b-256 checksum
How to use checksums
b424568ec6192d929e3a2fa7de2c7e51377ad36170835bc34405c6c8f44a4c74
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / selenium_proxy_auth-0.1.0-py3-none-any.whl

Download URL selenium_proxy_auth-0.1.0-py3-none-any.whl
Size 5.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c7b5b72ca8f7f7909b65066a9a0b3e0a7670c2d1cff7c5d84f24ec674994315f
BLAKE2b-256 checksum
How to use checksums
5fb2061a94677a03e899cd023dc40712d700680b10384959a8c982cbdf0b7bee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Security for selenium-proxy-auth 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page