Guides
How to use a proxy with a login and password in Selenium (Python)
A Selenium limitation: Chrome does not accept a proxy login and password through settings, and what to use instead.
What you need
The proxy is issued in the format host:port:login:password. The task: send a request through such a proxy from an automated Chrome.
An honest limitation
In the Selenium documentation a proxy is configured through the proxy capability, which takes only an address. There are no parameters for a login and password, and Chrome does not take credentials from the address in the --proxy-server flag. As a result, when opening a page the browser shows an authentication window that WebDriver cannot fill in. We did not find a way to pass a proxy login and password that is confirmed by the Selenium documentation, so this guide does not offer one.
About selenium-wire
The selenium-wire package used to be the way to handle proxies with a login. The author marked it as unmaintained, and the GitHub repository was archived on January 3, 2024. We do not recommend using it in new projects.
Example
If the task allows changing tools, move it to Playwright for Python. It can go through an HTTP proxy with a login and password, and the code is similar to Selenium: open a page and read the text.
pip install playwright
playwright install chromiumfrom playwright.sync_api import sync_playwright
with sync_playwright() as p:
browser = p.chromium.launch(
proxy={
# The proxy scheme is http:// even for HTTPS sites
"server": "http://HOST:PORT",
# Login and password in separate fields, no need to encode them
"username": "LOGIN",
"password": "PASSWORD",
}
)
page = browser.new_page()
page.goto("https://api.ipify.org", timeout=30000)
# The service returns the address the request came from
print(page.inner_text("body"))
browser.close()If SOCKS5
For Selenium, SOCKS5 with a login and password is likewise not confirmed by the documentation. Use Playwright with the proxy's HTTP port, as in the example.
Common errors
- A login and password prompt appears or error 407: Chrome did not receive the proxy credentials. This is a limitation, not a bug in your code.
- Timeout or ERR_PROXY_CONNECTION_FAILED: check HOST and PORT and whether you put the SOCKS5 port into HTTP mode.
- Special characters in the password: in Playwright, username and password are passed in separate fields and need no encoding. Do not put the login and password into the --proxy-server address.
- The https:// scheme in the proxy address: the issued proxy works over HTTP, so write http://HOST:PORT.
Sources
Checked against the official documentation: October 2026. Program interfaces change: if item names differ, follow the documentation.
- Selenium: Driver options, proxy (opens in a new tab)
- selenium-wire: репозиторий (архив) (opens in a new tab)
- Playwright: Network, HTTP proxy (opens in a new tab)
All guides are collected on the Guides page.
Find a proxy in the chat