Proxy plans now up to 15% cheaper
View pricing

Selenium

Set up a proxy in Selenium, including authenticated proxies. Configure Chrome/Firefox options and run with ready-to-use code.

Integrations6 min read

This page covers Selenium proxy setup for both Chrome and Firefox, including authenticated proxies. Selenium drives a real browser, so a ColdProxy gateway works the same way it does for any user agent, but there is one sharp edge: neither Chromium (on its --proxy-server flag) nor Firefox (in its proxy preferences) accepts inline username:password credentials. Below are the reliable ways to authenticate a ColdProxy gateway from Selenium 4.x, in the order we recommend them, plus how to pin geo and sticky sessions through the proxy username. If proxies are new to you, start with what is a proxy server and IP whitelisting vs username/password.

Note

ColdProxy auto-detects HTTP, HTTPS, and SOCKS5 on every port in the 30000-34999 range. Browsers route through Chromium's network stack, so prefer HTTP(S) for Selenium; SOCKS5 with a username and password is not supported by the browser (see SOCKS5 vs HTTPS proxies).

Your ColdProxy connection details

Every ColdProxy plan gives you a gateway host, a port from your plan's allocation, and a username/password pair:

Code
Host:     gw-2312.coldproxy.com
Port:     30000        (any port in your plan's 30000-34999 allocation)
Username: USERNAME     (may carry geo/session tags — see below)
Password: PASSWORD

2312 is your service/package ID from the client area. Residential IPv4 (GB Based) and Residential IPv6 activate instantly after payment clears; Residential IPv4 (Unmetered) and Datacenter IPv6 start automatic setup after payment clears. Allow up to 10 minutes for those two plans and connect as soon as setup completes. See Activation and setup times, then verify the proxy with the proxy checker and confirm your egress IP with my IP.

Because ColdProxy supports IP authentication (whitelist up to 50 IPs in the client area, or via the plan API), Selenium can run with no username, no password, and no auth extension. Add the machine's public IP to your authorized list, and the gateway is issued in IP:PORT form. See IP whitelisting in the glossary.

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

options = Options()
# IP-auth: no user:pass needed because your IP is whitelisted
options.add_argument("--proxy-server=http://gw-2312.coldproxy.com:30000")

driver = webdriver.Chrome(options=options)
driver.get("https://api.vipv6proxy.com/api/checker/my-ip")
print(driver.page_source)
driver.quit()

Firefox uses the same approach through preferences:

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

options = Options()
options.set_preference("network.proxy.type", 1)
options.set_preference("network.proxy.http", "gw-2312.coldproxy.com")
options.set_preference("network.proxy.http_port", 30000)
options.set_preference("network.proxy.ssl", "gw-2312.coldproxy.com")
options.set_preference("network.proxy.ssl_port", 30000)

driver = webdriver.Firefox(options=options)
driver.get("https://api.vipv6proxy.com/api/checker/my-ip")
print(driver.page_source)
driver.quit()
Warning

With IP authentication and no SuperPorts configured, the gateway defaults to Worldwide geo. To geo-target as an IP-auth user, bind country/state/city to a port range with SuperPorts, then connect through one of those ports. Username tags (below) are the alternative when you authenticate with user:pass.

selenium-wire (user:pass without an extension)

selenium-wire wraps the driver and injects the Proxy-Authorization header for you, so you can pass USERNAME:PASSWORD. It is no longer actively maintained and breaks on blinker >= 1.8, so pin blinker==1.7.0:

Shell
pip install selenium-wire blinker==1.7.0
Python
from seleniumwire import webdriver  # note: import from seleniumwire

proxy_url = "http://USERNAME:PASSWORD@gw-2312.coldproxy.com:30000"

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

driver = webdriver.Chrome(seleniumwire_options=seleniumwire_options)
driver.get("https://api.vipv6proxy.com/api/checker/my-ip")
print(driver.page_source)
driver.quit()
Tip

selenium-wire also works with Firefox; pass the same seleniumwire_options to webdriver.Firefox(...). If you cannot pin blinker, use IP whitelisting or the auth-extension method below instead.

Selenium Chrome proxy authentication via a generated extension (user:pass, vanilla Selenium)

If you must use user:pass on stock Selenium, generate a small extension at runtime that answers the proxy auth challenge. This keeps credentials out of the command line.

Python
import os, zipfile, tempfile
from selenium import webdriver
from selenium.webdriver.chrome.options import Options

HOST, PORT = "gw-2312.coldproxy.com", 30000
USER, PWD = "USERNAME", "PASSWORD"

manifest = """{
  "version": "1.0.0",
  "manifest_version": 3,
  "name": "ColdProxy Auth",
  "permissions": ["proxy", "webRequest", "webRequestAuthProvider"],
  "host_permissions": ["<all_urls>"],
  "background": { "service_worker": "background.js" },
  "minimum_chrome_version": "108"
}"""

background = f"""
chrome.runtime.onInstalled.addListener(() => {{
  chrome.proxy.settings.set({{
    value: {{
      mode: "fixed_servers",
      rules: {{ singleProxy: {{ scheme: "http", host: "{HOST}", port: {PORT} }},
               bypassList: ["localhost"] }}
    }},
    scope: "regular"
  }});
}});
chrome.webRequest.onAuthRequired.addListener(
  () => ({{ authCredentials: {{ username: "{USER}", password: "{PWD}" }} }}),
  {{ urls: ["<all_urls>"] }},
  ["blocking"]
);
"""

path = os.path.join(tempfile.mkdtemp(), "coldproxy_auth.zip")
with zipfile.ZipFile(path, "w") as z:
    z.writestr("manifest.json", manifest)
    z.writestr("background.js", background)

options = Options()
options.add_extension(path)
driver = webdriver.Chrome(options=options)
driver.get("https://api.vipv6proxy.com/api/checker/my-ip")
print(driver.page_source)
driver.quit()
Warning

Recent Chrome builds restrict --load-extension for non-test launches, and the Manifest V3 service worker can be slow to wake before the first navigation. Packing the extension with add_extension (as above) is more reliable than --load-extension. Extensions also require the new headless mode: use --headless=new (the classic --headless does not load extensions at all). If extensions misbehave in your Chrome version, fall back to IP whitelisting or the CDP method.

CDP Fetch.continueWithAuth (advanced)

Selenium 4 exposes the Chrome DevTools Protocol, so you can answer the proxy auth challenge from Python with no extension. The sketch below shows the shape of the solution; it is not runnable as-is, because you must wire an event loop that answers Fetch.authRequired and Fetch.requestPaused before navigating (with Fetch.enable active and nothing responding, the page load stalls).

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

HOST, PORT = "gw-2312.coldproxy.com", 30000
USER, PWD = "USERNAME", "PASSWORD"

options = Options()
options.add_argument(f"--proxy-server=http://{HOST}:{PORT}")
driver = webdriver.Chrome(options=options)

driver.execute_cdp_cmd("Network.enable", {})
driver.execute_cdp_cmd("Fetch.enable", {"handleAuthRequests": True})
# Wire your CDP event loop to respond to Fetch.authRequired with:
#   Fetch.continueWithAuth { authChallengeResponse:
#     { response: "ProvideCredentials", username: USER, password: PWD } }
# and to Fetch.requestPaused with Fetch.continueRequest.

driver.get("https://api.vipv6proxy.com/api/checker/my-ip")
print(driver.page_source)
driver.quit()
Note

Selenium's synchronous client does not stream CDP events out of the box; most teams pair this with a bidi/CDP helper or the trio/websockets loop shown in current Selenium proxy guides. If that is more plumbing than you want, IP whitelisting is the simpler equivalent on ColdProxy.

Geo-targeting and sticky sessions through the username

When you authenticate with user:pass, ColdProxy reads geo and session controls from tags inside the username, using the grammar user-key-value-key-value... (full reference: Username tag scheme). Rotation is the default; for a sticky IP you must include both a session id and a duration. See rotating and sticky proxies explained and geo-targeting with proxies.

Python
# Rotating, United States (new IP per request)
USER = "user-country-us"

# Sticky for 10 minutes, United States (same IP while the session holds)
USER = "user-country-us-session-481516-time-10m"
Warning

The exact tag prefixes (for example country, state, city, session, time, identifier) are configured per product by ColdProxy. Confirm the prefixes for your plan in your client area before hardcoding them. Sticky duration limits differ by product: Residential IPv4 supports 5s-24h; Residential IPv6 and Datacenter IPv6 support 5s-FOREVER.

Drop the tagged username straight into any method above:

Python
proxy_url = "http://user-country-us-session-481516-time-10m:PASSWORD@gw-2312.coldproxy.com:30000"

Verify and troubleshoot

  • Confirm the egress IP and location with the proxy checker or load https://api.vipv6proxy.com/api/checker/my-ip in the driven browser.
  • A blank page or ERR_PROXY_CONNECTION_FAILED right after ordering can have several causes. Check your settings and service status. If you bought Residential IPv4 (Unmetered) or Datacenter IPv6, automatic setup may still be running for up to 10 minutes after payment clears; see Activation and setup times.
  • Repeated auth prompts mean the credential method is not firing: confirm the username/password, or switch to IP whitelisting.
  • For IPv6 plans, many target sites are IPv4-only (no AAAA record) and will fail over IPv6; check the destination with the IPv6 checker before buying, and see IPv6 reachability for the confirmed-platform list.
  • For other failures, the fix checklist is in Common errors & fixes.

Ready to provision? Compare plans on pricing or browse the proxy products.

Need a tailored proxy plan for a large project?

Need a different speed or traffic allowance? Contact us through the channels on our website so we can assess whether a custom plan is possible.

Contact Our Sales TeamTelegram & ticket support · English and Arabic