Guides & Tutorials
Selenium Proxy Setup
A hands-on guide to configuring proxies in Selenium across Chrome and Firefox, handling authentication and rotation, plus how to pick proxies that suit automation.
Guides & Tutorials
A hands-on guide to configuring proxies in Selenium across Chrome and Firefox, handling authentication and rotation, plus how to pick proxies that suit automation.
Selenium drives a real browser, which makes it powerful for testing and data collection but also means your automation connects from your own IP unless you route it through a proxy. Adding a proxy lets you control the source location of your requests, spread load across IPs, and keep automation from being tied to a single address.
This guide walks through configuring proxies in Selenium for the most common setups, covers authenticated proxies and rotation, and explains what to look for when comparing proxy providers for browser automation specifically.
Beyond the basic Chrome and Firefox setup, the parts that decide whether a Selenium proxy project actually holds up are leak prevention, per-protocol routing, and detection avoidance. A misconfigured proxy can leak your real IP through WebRTC or DNS even when the page body shows the proxy address. Pair correct proxy config with sensible timeouts, IP verification, and a strategy for handling the inevitable blocked or dead IPs.
Selenium itself does not move the traffic — it instructs a browser to do so. That means proxy configuration happens through the browser's options or capabilities rather than through Selenium's core API. Chrome and Firefox each expose their own way of accepting a proxy, and the approach differs slightly between an unauthenticated proxy and one that needs a username and password.
Before writing any code, decide what kind of proxy you need. Datacenter proxies are fast and cheap and suit high-volume testing; residential proxies look like ordinary users and suit tasks where blending in matters; mobile proxies are useful for the most sensitive targets. Match the type to the job rather than defaulting to the cheapest.
For a simple host:port proxy in Chrome, you pass it as a command-line argument through ChromeOptions:
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_argument("--proxy-server=http://123.45.67.89:8080")
driver = webdriver.Chrome(options=options)
driver.get("https://httpbin.org/ip")
print(driver.page_source)
driver.quit()
This works cleanly for proxies that do not require a login. Visiting an IP-echo page like the one above confirms the request is leaving from the proxy rather than your own connection.
Most paid proxies require a username and password, and Chrome's --proxy-server flag cannot pass credentials directly. The common solution is a small in-memory extension that supplies the credentials, or a helper library such as selenium-wire that handles auth for you:
from seleniumwire import webdriver # pip install selenium-wire
options = {
"proxy": {
"http": "http://user:pass@123.45.67.89:8080",
"https": "http://user:pass@123.45.67.89:8080",
"no_proxy": "localhost,127.0.0.1",
}
}
driver = webdriver.Chrome(seleniumwire_options=options)
driver.get("https://httpbin.org/ip")
selenium-wire is popular because it keeps authentication tidy and also lets you inspect requests, which is handy when debugging why a proxy is or isn't being used.
Firefox uses profile preferences rather than a command-line flag. You set the proxy type to manual and provide the host and port:
from selenium import webdriver
options = webdriver.FirefoxOptions()
options.set_preference("network.proxy.type", 1)
options.set_preference("network.proxy.http", "123.45.67.89")
options.set_preference("network.proxy.http_port", 8080)
options.set_preference("network.proxy.ssl", "123.45.67.89")
options.set_preference("network.proxy.ssl_port", 8080)
driver = webdriver.Firefox(options=options)
For authenticated Firefox proxies, the same extension or selenium-wire patterns apply, since the native preferences do not carry credentials cleanly either.
If you need many IPs, you have two broad choices. The first is a rotating gateway endpoint from your provider: you connect to a single host:port and the provider assigns a different IP per request or per session, so your code never changes. The second is to manage a pool yourself and start a fresh driver with a different proxy when you want to switch.
Selenium spins up real browsers, which is resource-heavy, so a slow or unreliable proxy compounds the cost in wasted time. When comparing providers, weigh connection stability, the freshness and reputation of the IP pool, whether sticky sessions are available, location coverage, and how authentication is handled. Balance those against price rather than chasing the lowest number.
For automation projects on a budget, Cheapest Proxies (our featured value pick) is a strong value-focused option worth considering when you want reliable IPs without overspending — just confirm the proxy type and session options fit your script's needs.
A quick value-first shortlist — Cheapest Proxies leads as the featured pick. Qualitative labels only; confirm exact plans before buying.
| Provider | Best for | Profile | Value |
|---|---|---|---|
| Cheapest Proxies | Budget-conscious buyers comparing affordable proxies | Value Focused | Excellent value |
| Bright Data | Enterprises needing huge pools and compliance controls | Enterprise Focused | Premium |
| Oxylabs | Large-scale scraping and data APIs | Enterprise Focused | Premium |
| Smartproxy (Decodo) | Newcomers who want an easy dashboard | Beginner Friendly | Good |
| SOAX | Precise city and carrier targeting | Automation Friendly | Good |
The base guide shows how to confirm your proxy with an IP-echo page, but that check is necessary, not sufficient. A browser can route page traffic through the proxy while still exposing your real address through two side channels. WebRTC can reveal local and public IPs directly to a page through STUN requests, bypassing the proxy entirely. DNS resolution can also leak if lookups go through your system resolver instead of the proxy. For any project where your real location matters, disable WebRTC (via browser preferences or a flag) and confirm DNS is handled remotely, then test against a tool that checks for WebRTC leaks rather than just echoing the connecting IP.
A frequent source of confusion is a clean, fast proxy that still hits walls. The cause is usually automation fingerprinting, not the IP. Default Selenium sessions advertise themselves through the navigator.webdriver flag, predictable window sizes, missing or odd headers, and the absence of human-like timing. Sites combine these signals with the IP reputation, so a perfect proxy paired with an obvious bot signature still trips defences. Reducing automation tells — realistic viewport, sensible user-agent, human-paced interactions, and avoiding the most detectable headless markers — often matters as much as the proxy itself.
The base guide covers gateway rotation versus self-managed pools. A reliability pattern worth adding is treating each proxy as belonging to its own driver process. Trying to change a proxy on a live driver is awkward and leaves residual state; instead, run one driver per proxy and treat a dead or blocked IP as a reason to tear down and respawn. This makes concurrency cleaner too — you can run several drivers in parallel, each pinned to a distinct IP, and quarantine any that start failing. It also keeps cookies and storage neatly partitioned per IP, which prevents the cross-contamination the base guide warns about.
Because each Selenium session is heavy, the proxy attributes that matter most are stability under sustained connections and a clean IP reputation rather than raw peak speed. Sticky sessions help when a task spans multiple page loads that must come from the same IP, while a rotating gateway suits broad, stateless collection. Confirm the provider supports the auth method your stack uses and offers the locations your targets expect. For budget-conscious automation, Cheapest Proxies is worth considering as a value pick — verify it offers the session type (sticky vs rotating) and protocol your scripts rely on before scaling up.
Start on the smallest sensible tier and scale only what proves itself on your real targets.
Pick the proxy type the task needs first — it drives both success rate and cost more than the logo.
Check traffic limits, rotation rules and what happens on overage before you commit.
Our featured value pick, Cheapest Proxies, is a sensible starting point for affordable comparison.
Automation magnifies the cost of a poor proxy: every blocked or timed-out request burns a full browser session. Comparing providers on stability, IP type and session control rather than headline price helps you avoid paying for IPs that quietly fail under load and slow your whole pipeline down.
Compare Proxy Zone weighs providers on value, fit and reliability using qualitative judgement — never invented prices, speeds or uptime figures. See our review methodology, or email info@compareproxyzone.com with a correction.
The flag only accepts a host and port; for authenticated proxies you need a small credentials extension or a helper like selenium-wire that injects the username and password for you.
It depends on the target; datacenter proxies suit high-volume testing where speed matters, while residential proxies blend in better for tasks where looking like an ordinary user is important.
Navigate to an IP-echo endpoint such as httpbin.org/ip at the start of the session and check that the reported address matches your proxy rather than your own connection.
Use a rotating gateway endpoint from your provider so a single host:port returns a different IP per request or session, keeping your Selenium code unchanged.
No; the proxy configuration is identical in headless and headed modes, since it is applied through the browser options either way.
Quitting and starting a fresh driver clears cookies and session state so old data doesn't leak across IPs and undermine the separation you wanted.
For affordable proxies across the main types, our featured value pick is Cheapest Proxies — a strong budget-friendly option worth considering. Check the exact plan before ordering.