Selenium Proxy Authentication: What Works with Chrome
Chrome does not accept a username and password in the proxy string, and Selenium has no separate field for them. Here are the options that remain and the limits of each.
Updated · Prokso editorial team
- Selenium with Chrome cannot pass a username and password in --proxy-server
- The simplest fix is IP access in the dashboard, up to 5 addresses; other paths are an extension or a BiDi handler
- selenium-wire is no longer maintained, so do not use it in new projects
What the error means
Selenium passes the proxy to Chrome with the --proxy-server argument, and Chromium drops a proxy address that contains a username and password. As a result the browser is left without a proxy and shows ERR_NO_SUPPORTED_PROXIES. If you simply leave the username out, the proxy replies with 407 and waits for credentials.
With SOCKS5 it is even stricter: according to the Chromium documentation, Chrome supports no authentication methods for SOCKSv5. So SOCKS5 with a username will not work in Chrome, with or without Selenium.
There are four working paths: remove the username with IP access, hand the login to an extension, use a WebDriver BiDi authentication handler, or put an intermediate proxy such as selenium-wire in between. Below is what is still relevant now.
Causes
- A username in --proxy-server. Chromium treats the string
http://USERNAME:PASSWORD@gw.prokso.com:823as invalid and drops it. - The extension did not load. An extension that answers the proxy request through chrome.webRequest.onAuthRequired needs the webRequestAuthProvider permission in Manifest V3. On top of that, branded Chrome builds dropped the --load-extension flag in Chrome 137; it still works in Chromium and Chrome for Testing.
- An outdated selenium-wire. The selenium-wire repository is archived, and the author states in the README that the project is no longer maintained. There will be no fixes for new Selenium and Chrome versions.
- SOCKS5 with a username. Chrome cannot authenticate to SOCKS5, so port 824 with a username results in a SOCKS handshake error.
How to fix it
- The simplest way: add the IP of your server or computer to IP access in the dashboard (up to 5 addresses) and start Chrome with
--proxy-server=http://gw.prokso.com:823without a username. SOCKS5 works the same way:socks5://gw.prokso.com:824. An example is in the Selenium guide. - If the machine IP changes often, use an extension with a chrome.webRequest.onAuthRequired handler: its isProxy field is true for a Proxy-Authenticate request, and the extension returns the username and password. For Chrome 137 and later, load it in Chrome for Testing or Chromium.
- WebDriver BiDi: set
options.enable_bidi = Trueand add a handler withdriver.network.add_auth_handler('USERNAME', 'PASSWORD'). The Selenium documentation describes authentication handlers for Basic and Digest prompts and says nothing specific about proxies, so test it with a 407 response on your Chrome and Selenium versions. - Do not use selenium-wire in new projects: it is no longer maintained. If you already have it, plan a move to IP access or BiDi.
- If you see 407 instead of the page, check the username and password with the 407 Proxy Authentication Required page; if the browser does not reach the gateway, use the ERR_PROXY_CONNECTION_FAILED page.
How to check that it works
Open https://prokso.com/ip through Selenium and read the JSON from the page: ip, country and org should belong to the proxy. If something is off, go through the step-by-step check.
Two-minute diagnosis
First paste the line into the proxy checker. If the proxy works there, the cause is in your app or its settings. If not, test the line from a terminal:
curl -v -x "http://USERNAME:PASSWORD@gw.prokso.com:823" https://api.ipify.org
- A
< HTTP/1.1 407line right afterCONNECTmeans the proxy answered. The name after the code, for exampleNO_USER, points to the cause. - The proxy answered
CONNECTwith 200 and then another code arrived - the proxy works, and that answer came from the website. - No answer at all, only a timeout - the connection never reached the proxy: check the host, port and network.
Setup guides where this error comes up
FAQ
Can I pass the username through ChromeOptions?
No. The --proxy-server argument passes only the scheme, host and port to Chrome, and Chromium drops an address with a username and password. The login is passed by an extension or through BiDi, or replaced with IP access.
Does IP access give one IP for the whole session?
IP access only removes the username. IP stability depends on the port: 823 and 824 give a new IP for every request, while ports 10000-20000 keep a sticky IP for the session duration. More in <a href="/en/glossary/sticky-session">sticky session</a>.
How many addresses can I add to IP access?
Up to 5 addresses per plan. If you have more machines, the rest can log in with a username through an extension or BiDi; the username syntax is on the <a href="/en/help/gateway">gateway</a> page.
Other proxy errors
Residential $1.59, mobile $2.50, datacenter $0.65 per GB
Sign up in a minute, get access right after payment.