How to Use Proxies with Selenium (2026 Guide)

Complete guide to configuring HTTP, HTTPS, SOCKS5, authenticated, and rotating proxies with Selenium in 2026. Covers Python, Java, and Node.js with working code examples, anti-detection tips, and common troubleshooting fixes.

How to Use Proxies with Selenium (2026 Guide)

Selenium is the most widely used browser automation framework in the world. It powers end-to-end testing suites, headless scrapers, and automated workflows in companies of every size. But running Selenium against modern websites without proxies is a fast path to IP bans, captchas, and empty responses.

This guide covers every proxy configuration you'll need for Selenium in 2026 — HTTP, HTTPS, SOCKS5, authentication, rotation, and geo-targeting — with working code in Python, Java, and Node.js.

What Is Selenium?

Selenium is an open-source suite for automating real browsers (Chrome, Firefox, Edge, Safari) via a standardized WebDriver protocol. Unlike requests or httpx, Selenium executes JavaScript, handles cookies, renders pages, and interacts with UI elements exactly like a human would.

Common use cases:

End-to-end UI testing Web scraping (JavaScript-heavy pages, SPAs) Automated form submissions and data entry Price monitoring and competitor research Social media automation and multi-account management Screenshot and PDF capture

The challenge: the same realism that makes Selenium powerful makes it detectable. Without proxy rotation, every request comes from a single IP — trivial for any rate limiter or bot defender to catch.

Why Proxies Are Essential for Selenium

Here's what happens when you run Selenium without proxies at any real scale:

HTTP 429 (Too Many Requests) — server sees too many requests from one IP CAPTCHAs — reCAPTCHA, hCaptcha, Cloudflare Turnstile appear on every page load Soft bans — site returns empty results, shadow-blocks your IP, or redirects to a "suspicious activity" page Hard bans — IP blocked for hours, days, or permanently

The root cause is always the same: one IP, many requests. Proxies fix this by distributing traffic across a pool of residential, mobile, or datacenter IPs — each request looks like it comes from a different user.

Proxies also let you:

Geo-target — appear to browse from USA, UK, Germany, Spain, or 40+ other countries Test localisation — verify your app returns the correct content per region Bypass geo-blocks — access content restricted to specific countries Scale scraping — hundreds of concurrent sessions without rate limits

1. Basic HTTP/HTTPS Proxy — Python

The simplest Selenium proxy setup uses ChromeOptions (or FirefoxOptions) to inject proxy settings before launching the browser.

For Firefox:

> Note: The --proxy-server flag applies to HTTP, HTTPS, and FTP. Chrome does not use separate settings for each — one flag covers all.

2. Authenticated Proxies (Username & Password) — Python

Most premium proxies require credentials. Chrome's WebDriver doesn't support proxy authentication in the --proxy-server flag directly. The standard workaround is a local proxy plugin that injects the Proxy-Authorization header.

Why the plugin approach? Chrome's --proxy-server flag sets the proxy address but provides no mechanism for credentials. The extension intercepts the onAuthRequired event and supplies them automatically.

Firefox — authenticated proxies

Firefox handles proxy auth much more cleanly — just set the preferences directly:

> Pro tip: xProxy Market plans support IP whitelisting — whitelist your server's IP and skip credentials entirely, simplifying your Selenium code significantly.

3. SOCKS5 Proxies — Python

SOCKS5 proxies operate at the TCP layer, tunnelling all traffic regardless of protocol. Use the socks5:// scheme:

Authenticated SOCKS5: Chrome does not support username:password in the socks5:// scheme via --proxy-server. If your SOCKS5 proxy requires authentication, use one of:

Switch to HTTP/HTTPS — most proxy providers (including xProxy Market) offer both Local proxy chain — run gost or proxychains locally; it authenticates SOCKS5 and exposes an unauthenticated localhost endpoint to Selenium

Then in Selenium:

4. Java — HTTP and Authenticated Proxies

For Java Selenium users, the setup is similar but uses ChromeOptions from the Java bindings:

For authenticated proxies in Java, use the same Chrome extension approach — generate the plugin ZIP programmatically:

5. Node.js (selenium-webdriver)

For authenticated proxies in Node.js, use the same ZIP plugin approach as the Python version — just generate the files with fs and archiver:

6. Rotating Proxies with Selenium

Proxy rotation is the key to large-scale scraping without bans. There are two approaches:

Provider-side rotation (recommended)

Your proxy provider handles rotation automatically. Use a single endpoint — each new TCP connection gets a fresh exit IP from the pool.

xProxy Market residential and mobile plans rotate the exit IP automatically — just keep the same credentials and the upstream handles the rest.

Client-side rotation (you control the swap)

Re-launch the browser with a new proxy for each task. This gives you full control at the cost of browser startup overhead:

> Tip: Keep the browser open and reuse it when using provider-side rotation. Close and relaunch only when switching to a specific geo-location or when re-authenticating.

7. Geo-Targeting with Country Proxies

Need to test localised content, bypass geo-restrictions, or scrape region-specific results? Match the proxy's country to your browser's locale settings:

Available geo-locations through xProxy Market:

USA Proxies — residential, mobile, datacenter