How to Set Up Proxies in Selenium 2026

Learn how to set up proxies in Selenium in 2026 — native vs selenium-wire, authenticated and rotating proxies, headless setup, and the gotchas to avoid, with code.

Author
ProxyHorizon Team
Published
June 27, 2026
12 min read
Expert-Verified

Here is the uncomfortable truth most Selenium tutorials skip: adding --proxy-server and calling it done is exactly why your scraper still gets blocked — or breaks on the first authenticated proxy. The one-line snippet works in a blog screenshot and falls apart in production.

It matters because the demand is real. Automated traffic is now nearly half of all web activity (Imperva), and Selenium drives a huge share of it for scraping, testing, and automation. But Selenium's built-in proxy support is genuinely half-baked for the thing most people actually need — proxies with a username and password.

So this guide goes past the snippet. You will learn how to wire any proxy into Selenium (with or without auth), rotate IPs, verify it actually works, and dodge the gotchas that quietly waste hours. New to proxy types? Skim our guide to the types of proxies first, then come back.

The Quick Answer

Our take: for a quick IP:port proxy with no login, use Selenium's native --proxy-server flag. For anything with a username and password — which is every commercial proxy — use selenium-wire. It is the pragmatic fix for Selenium's biggest proxy weakness, and it is what we reach for in almost every real project.

Why Authenticated Proxies Break Plain Selenium

Plain Selenium can point Chrome at a proxy, but it has no clean way to answer the browser's username/password popup. When your provider requires auth (they all do), Chrome throws a native dialog that Selenium cannot fill, and your script just hangs or fails.

The real problem is that proxy auth happens at the browser-UI layer, which WebDriver was never designed to touch. You can hack around it with a custom Chrome extension, but that is fragile and ugly. selenium-wire solves it properly by handling the proxy at the network layer, credentials and all. Here is how each method stacks up.

MethodAuth supportDifficultyBest for
--proxy-server argumentNoEasyQuick IP:port proxies with no login
selenium-wireYes (user:pass)EasyMost real proxies — recommended
Custom auth extensionYesHardNiche edge cases only
Provider gateway + selenium-wireYes + rotationEasyScraping at scale

Method 1: The Native Way (No Authentication)

If your proxy needs no login, Selenium handles it in one argument. This is fine for free or IP-whitelisted proxies, but be honest about the ceiling — most reliable proxies are not on this list.

Python
from selenium import webdriver
from selenium.webdriver.chrome.options import Options

PROXY = "198.51.100.1:8080"

options = Options()
options.add_argument(f"--proxy-server=http://{PROXY}")

driver = webdriver.Chrome(options=options)
driver.get("https://httpbin.org/ip")   # shows the exit IP
print(driver.page_source)
driver.quit()

Load httpbin.org/ip and you should see the proxy's address, not yours. The moment a provider asks for credentials, though, this approach stops working — which is most of the time.

Method 2: The Reliable Way (selenium-wire, With Auth)

This is the method to actually remember. selenium-wire is a drop-in replacement for Selenium's WebDriver that accepts a proxy — username and password included — without any popup drama.

Python
# pip install selenium-wire
from seleniumwire import webdriver

proxy = "http://USER:PASS@gate.provider.com:7000"

seleniumwire_options = {
    "proxy": {
        "http": proxy,
        "https": proxy,
        "no_proxy": "localhost,127.0.0.1",
    }
}

driver = webdriver.Chrome(seleniumwire_options=seleniumwire_options)
driver.get("https://httpbin.org/ip")
print(driver.find_element("tag name", "body").text)   # confirms the proxy IP
driver.quit()

Real-world tip: keep the no_proxy entry for localhost so your own test servers and webdriver traffic do not get routed through the proxy. It is a small line that saves confusing failures.

Method 3: Rotating Proxies in Selenium

One IP firing hundreds of requests is a fast track to a ban. Rotation spreads requests across many addresses so no single one stands out. The simplest pattern is to pick a fresh proxy each time you spin up a driver.

Python
import random
from seleniumwire import webdriver

PROXIES = [
    "http://u:p@198.51.100.1:7000",
    "http://u:p@198.51.100.2:7000",
    "http://u:p@198.51.100.3:7000",
]

def make_driver():
    proxy = random.choice(PROXIES)
    opts = {"proxy": {"http": proxy, "https": proxy, "no_proxy": "localhost,127.0.0.1"}}
    return webdriver.Chrome(seleniumwire_options=opts)

driver = make_driver()
driver.get("https://httpbin.org/ip")
print(driver.find_element("tag name", "body").text)
driver.quit()

Want retries, health checks, and a cleaner pool? Our walkthrough on building a rotating proxy script covers the production-grade version of this loop.

Method 4: Use a Provider Rotating Gateway (the Easy Win)

Managing a proxy list is busywork. Most premium providers hand you a single rotating endpoint that swaps the IP automatically on each connection — so you set it once and forget the list entirely.

Python
from seleniumwire import webdriver

# One endpoint that rotates the exit IP for you on each new connection
gateway = "http://USER:PASS@gate.provider.com:7000"

opts = {"proxy": {"http": gateway, "https": gateway, "no_proxy": "localhost,127.0.0.1"}}
driver = webdriver.Chrome(seleniumwire_options=opts)
driver.get("https://httpbin.org/ip")
print(driver.find_element("tag name", "body").text)
driver.quit()

Our take: for most teams this beats hand-rolling rotation. You offload pool freshness, retries, and replacement to the provider and keep your code dead simple.

How to Verify Your Proxy Actually Works

Never trust a proxy blindly — a silent fallback to your real IP is the classic way to get your home address banned. After connecting, load httpbin.org/ip and confirm the returned address is the proxy, not yours.

For geo-targeted proxies, also check that the reported country matches what you expect. If you see your own IP, the proxy is not being applied — recheck the scheme (http://), the port, and the credentials before blaming the provider.

Running Headless and Avoiding Detection

Proxies hide your IP, but they do nothing about the browser fingerprint that screams "automation". Pair your proxy with a few hardening flags, and remember a proxy is necessary but not sufficient on bot-aware sites.

Python
from selenium.webdriver.chrome.options import Options

options = Options()
options.add_argument("--headless=new")
options.add_argument("--disable-blink-features=AutomationControlled")
options.add_argument("--window-size=1920,1080")

For the full anti-bot playbook — stealth, behavior, and headers — see our Selenium web scraping guide, and for tough targets specifically, how to bypass Cloudflare when scraping.

Which Proxy Type Should You Use With Selenium?

The method gets the proxy connected; the type decides whether you stay connected. Match it to how hard your target fights bots.

Proxy typeDetection riskBest for
DatacenterHigherSpeed and bulk on lenient sites
ResidentialLowMost real scraping and account work
ISP (static residential)Low to mediumSpeed plus a residential reputation
MobileLowestThe strictest targets and apps

If you are unsure, start with datacenter and escalate to residential proxies only when blocks appear. The same selenium-wire setup works for every type — you just swap the endpoint.

Best Proxies to Use With Selenium

Your code is only as good as the IPs behind it. Free proxy lists are slow and short-lived; for anything serious, a paid network with auth and rotation is worth it. These are the providers we rate most highly for Selenium.

1Decodo

Pool:115M+
Uptime:99.99%
Latency:0.6s
Countries:195+
Huge 97M+ residential IP pool
Beginner-friendly dashboard and documentation
Flexible pay-as-you-go pricing
High success rates on tough targets
Fast 24/7 live chat support
Free trial and money-back guarantee

Decodo is our all-round default for Selenium: a large residential pool, a rotating gateway that drops straight into the Method 4 snippet, and a friendly dashboard that makes credentials easy to find.

Its balance of price, reliability, and ease of use suits everyone from solo scrapers to small teams who want rotation that just works.

2Oxylabs

Pool:102M+
Uptime:99.99%
Latency:0.6s
Countries:195+
Massive 102M+ IP Pool
Ethically Sourced & Compliant
AI-Powered Web Unblocker
Dedicated Account Manager
Advanced ASN & City Targeting

Oxylabs is the enterprise pick, with a massive network and excellent geo-targeting for Selenium jobs that run at serious scale. It also offers scraper APIs if you outgrow driving a browser yourself.

It costs more, but for high-volume, mission-critical scraping the success rates and support justify the premium.

3IPRoyal

Pool:32M+
Uptime:99.9%
Latency:0.8s
Countries:195+
Traffic never expires (pay-as-you-go)
Ethically sourced residential IPs
Crypto and flexible payment options
Affordable entry pricing
Sticky sessions up to 24 hours

IPRoyal is the value champion, well known for non-expiring traffic that suits intermittent Selenium runs where you do not want unused data to vanish each month.

With both rotating and sticky residential sessions at approachable prices, it is a great fit for individuals and smaller projects.

4Webshare

Pool:10M+
Uptime:99.97%
Latency:1.0s
Countries:50+
Extremely cheap entry pricing
Free 10-proxy plan available
Highly customizable proxy lists
Fast self-serve dashboard and API
Unlimited bandwidth on datacenter plans

Webshare is the budget-friendly developer favorite, with a free tier that is perfect for testing your selenium-wire setup before spending anything. Its clean API makes pulling proxies effortless.

Use the free datacenter tier for prototyping, then upgrade to residential when your target sites start fighting back.

How to Choose Your Setup

The methods above cover everyone; these questions narrow it to your case.

1Do your proxies need authentication?

If yes — and they almost certainly do — use selenium-wire. The native flag only works for login-free proxies, which are rare among reliable providers.

2Do you need a stable session or broad rotation?

Logging in or holding a cart? Use sticky sessions. Scraping many independent pages? Rotate aggressively with a list or a provider gateway.

3How strict is your target?

Lenient sites are fine on datacenter IPs; bot-aware sites need residential or mobile. Do not overpay for stealth a gentle target never tests, and do not cheap out on one that does.

Common Mistakes to Avoid

Most "my Selenium proxy is not working" tickets come down to these.

1Expecting the native flag to handle auth

The --proxy-server argument cannot answer a credentials popup. If your proxy needs a username and password, reach for selenium-wire instead of fighting Chrome's dialog.

2Forgetting the URL scheme or port

A proxy string without http:// or the port silently fails to apply. Always use the full http://user:pass@host:port shape.

3Never verifying the exit IP

If you do not check httpbin.org/ip, you will not notice when traffic quietly falls back to your real address — and that is the address that gets banned.

4Rotating the IP mid-session

Swapping proxies in the middle of a logged-in flow looks like account hijacking to the site. Use a sticky IP for multi-step journeys and rotate only between independent tasks.

5Trusting free proxies in production

Free proxies are slow, overcrowded, often already banned, and sometimes malicious. They are fine for a five-minute experiment and a liability for anything real.

Best Practices for Proxies in Selenium

  • Use selenium-wire for any authenticated proxy — it is the path of least pain.
  • Verify the exit IP on every fresh setup with httpbin.org/ip.
  • Match the proxy type to the target: datacenter for speed, residential or mobile for stealth.
  • Rotate plus pace — add randomized delays so even rotated IPs look human.
  • Pick a quality provider — compare options in our proxy directory and test on a free tier first.

Sticky Sessions vs Rotating IPs

Not every Selenium job wants a fresh IP on every request. The right choice depends on whether your task is one continuous journey or many independent visits — and getting this wrong is a quiet cause of bans.

Sticky sessions keep the same IP for a set window (often up to 10–30 minutes). Use them whenever state matters: logging in, adding items to a cart, paginating through a results set, or anything multi-step. Switching IPs mid-flow looks like a hijacked account and triggers security checks.

Rotating IPs change the address frequently, ideally per request or per driver. They shine for breadth — scraping thousands of independent product pages where no single page depends on the last. Most providers expose both modes on the same credentials; you just hit a different port or endpoint.

Our take: default to rotating for collection-style scraping and switch to sticky the moment a workflow needs to remember who you are. Mixing them deliberately — sticky for login, rotating for the crawl — is how mature scrapers stay under the radar.

Real-World Use Cases for Proxies in Selenium

Proxies are not just a scraping bandage — they unlock entire categories of automation that are impossible from a single office IP. Here is where teams lean on the setups above every day.

Price and market monitoring: e-commerce and travel sites show different prices by region and quietly throttle repeat visitors. Geo-targeted residential proxies let your Selenium scripts see accurate local pricing without getting rate-limited.

SEO and SERP tracking: checking rankings from many locations needs IPs in those locations. Rotating proxies make a Selenium-driven rank tracker look like real searchers across cities rather than one bot hammering Google.

Ad verification: advertisers use residential and mobile proxies to confirm their campaigns render correctly — and are not replaced by competitor or fraudulent ads — in each target market.

QA and localization testing: teams point Selenium through proxies in different countries to verify geo-redirects, currency, language, and compliance banners behave as designed. For the broader workflow, our Selenium scraping guide ties these patterns together.

Frequently Asked Questions

For a login-free proxy, pass it with Chrome’s --proxy-server argument in the browser options. For a proxy that needs a username and password — which is most commercial proxies — use selenium-wire, a drop-in replacement that accepts the full http://user:pass@host:port string and handles authentication for you without any browser popup.
Not cleanly on its own. Plain Selenium can point at a proxy but cannot fill the browser’s username and password popup, so authenticated proxies hang or fail. The practical fix is selenium-wire, which handles proxy auth at the network layer. A custom Chrome extension also works but is fragile and not worth the hassle.
selenium-wire is an extension of Selenium’s Python bindings that gives you access to the underlying requests and, crucially, lets you set an authenticated proxy with one config object. It is the simplest reliable way to use real, credentialed proxies in Selenium, which is why it is our default recommendation for production scraping.
Two ways. Keep a list of proxies and pick a fresh one with random.choice each time you create a driver, passing it through selenium-wire. Or use a provider’s rotating gateway — a single endpoint that swaps the IP automatically on each connection — so you never manage a list. The gateway approach is simpler and scales better.
Yes. Chrome accepts a SOCKS proxy via --proxy-server=socks5://host:port for login-free SOCKS, and selenium-wire supports SOCKS proxies with authentication too. For most web scraping, HTTP or HTTPS proxies are the simpler default; reach for SOCKS5 only when your provider issues SOCKS endpoints or you need it specifically.
The usual culprits are a missing scheme or port in the proxy string, trying to use an authenticated proxy with the native flag, or a dead proxy. Load httpbin.org/ip to check the exit IP. If you still see your own address, the proxy is not being applied — fix the http://user:pass@host:port format and switch to selenium-wire for auth.
Navigate to httpbin.org/ip and read the response — it returns the IP the site sees. If it shows the proxy address, you are set; if it shows your real IP, the proxy failed to apply. For geo-targeted proxies, also confirm the reported country matches the location you selected.
It depends on the target. Datacenter proxies are fast and cheap and work on lenient sites. Bot-aware targets flag datacenter ranges quickly, so you will want residential or mobile proxies that look like real users. A good rule is to start with datacenter and escalate to residential only when blocks appear.
Yes — proxies work identically in headless mode. Add the --headless=new flag to your Chrome options alongside your selenium-wire proxy config. Just remember that headless browsers leak automation signals, so pair the proxy with stealth flags and human-like pacing on sites that actively detect bots.
It removes the easiest way to get caught — repeated traffic from one IP — but it is not a magic shield. Sites also fingerprint the browser, watch behavior, and check headers. Pair quality proxies with stealth settings, realistic pacing, and the right proxy type, and your block rate drops dramatically.

The Bottom Line

Setting up proxies in Selenium is easy once you stop fighting the runtime. For login-free proxies, the native --proxy-server flag is fine. For everything real — authenticated, rotating, production proxies — selenium-wire is the answer, and it turns a frustrating popup into a one-line config.

Wire it up, verify the exit IP, match the proxy type to your target, and rotate sensibly. Then pair it with a network that can keep up: compare options in our proxy provider directory, and if you also automate with Playwright, the same logic lives in our guide to using proxies in Playwright. Start small, test on your real targets, and scale only once the setup proves itself.