Rayobyte Guides

Using Rayobyte Proxies With Selenium

How to use Rayobyte proxies with Selenium in Python: IP whitelisting for the simplest setup, Selenium Wire or an extension for credentials, Firefox options, sessions and common errors.

By Team of Monkeys Editorial Updated 3 min read Affiliate disclosure

This guide contains affiliate links to Geonode, Webshare and Rayobyte. If you buy through them we may earn a commission, at no extra cost to you.

Rayobyte with Selenium illustration showing Selenium connecting through Rayobyte to Browser, covering webdriver, auth 3jdej38j4

The credential problem

Selenium drives real browsers, and Chrome's --proxy-server flag doesn't accept a username and password. There are three ways around it with Rayobyte:

  1. IP whitelisting: register your server's IP in the dashboard and use the proxy with no credentials. Simplest and most reliable.
  2. Selenium Wire: a library that runs a local proxy which adds credentials for you.
  3. A small browser extension that answers the proxy auth prompt.

Our Selenium proxies guide covers the general options.

Option 1: whitelisting

python
import os
from selenium import webdriver

opts = webdriver.ChromeOptions()
opts.add_argument(f"--proxy-server=http://{os.environ['RAYOBYTE_HOST']}:{os.environ['RAYOBYTE_PORT']}")
driver = webdriver.Chrome(options=opts)
driver.get("https://httpbin.org/ip")
print(driver.find_element("tag name", "body").text)
driver.quit()

Add your public IP to the whitelist first. See Rayobyte authentication options. With whitelisting, targeting and session options that normally live in the username may need to be set differently; check Rayobyte's connection docs for whitelisted access to rotating products.

Option 2: Selenium Wire

python
import os
from seleniumwire import webdriver

proxy = os.environ["RAYOBYTE_PROXY"]  # http://user:pass@host:port
driver = webdriver.Chrome(seleniumwire_options={
    "proxy": {"http": proxy, "https": proxy, "no_proxy": "localhost,127.0.0.1"}
})
driver.get("https://httpbin.org/ip")

Selenium Wire is convenient but adds a local hop and is less actively maintained than it once was. Test it with your Selenium version.

Option 3: Firefox

Firefox lets you set the proxy in preferences, and credentials can be handled with an extension or whitelisting:

python
opts = webdriver.FirefoxOptions()
opts.set_preference("network.proxy.type", 1)
opts.set_preference("network.proxy.http", os.environ["RAYOBYTE_HOST"])
opts.set_preference("network.proxy.http_port", int(os.environ["RAYOBYTE_PORT"]))
opts.set_preference("network.proxy.ssl", os.environ["RAYOBYTE_HOST"])
opts.set_preference("network.proxy.ssl_port", int(os.environ["RAYOBYTE_PORT"]))
driver = webdriver.Firefox(options=opts)

Residential tip: You can test most of this guide for free: Rayobyte offers a no-card trial on Premium Residential, rotating ISP and rotating datacenter proxies. Move to a paid plan once the pilot works. See our complete Rayobyte guide.

Sessions

One driver keeps one exit IP while connections stay open, so treat each driver as a session. To change IP, quit the driver and start a new one with a new session ID (with credentials) or let the rotating gateway assign a new IP. Premium Residential sessions last up to 120 minutes. See Rayobyte sticky sessions.

Product choice

Use Premium Residential for protected sites, rotating ISP for speed, and static ISP for logged-in profiles. Static ISP and datacenter IPs work cleanly with whitelisting.

Performance tips

  • Run headless (--headless=new) on servers.
  • Disable images with Chrome preferences to save bandwidth.
  • Use explicit waits instead of sleeps.
  • Quit drivers reliably in a finally block so sessions and memory are released.

Common errors

  • Auth popup appears: Chrome can't take credentials; use whitelisting, Selenium Wire or an extension.
  • ERR_PROXY_CONNECTION_FAILED: wrong host or port, or your IP isn't whitelisted.
  • Wrong location: check targeting and match the browser's locale and time zone.

More in Rayobyte troubleshooting. If Selenium's proxy handling gets in your way, Playwright accepts credentials natively.

Proxy tip: For a second opinion on hard targets, run the same test through Geonode residential proxies, which support sticky sessions up to 24 hours and ASN targeting. We compare the two in using Geonode with Selenium.

How it compares

See Rayobyte vs Geonode for Selenium, Rayobyte vs Webshare for Selenium and all three for Selenium.

Rayobyte, Geonode and Webshare are three options among many. Our best proxies in 2026 guide explains how to match a proxy type to each task, and cheap proxies that work shows where budget providers fit. For browser automation in depth, see our Puppeteer proxies guide.

Budget tip: For jobs where a fixed IP list is enough, Webshare is one of the cheapest options: shared datacenter proxies are sold by the IP, and static residential (ISP) proxies cost well under a dollar per IP per month at the time of writing. More in using Webshare with Selenium.

Key takeaways

  • Chrome can't take proxy credentials on the command line; whitelist your IP for the simplest Rayobyte setup.
  • Selenium Wire or an extension can add credentials when whitelisting isn't possible.
  • Treat each driver as a session and quit it to change IP.
  • Playwright is easier if you need per-session credentials.

FAQ

How do I use a Rayobyte proxy with authentication in Selenium?

Whitelist your IP, or use Selenium Wire or an auth extension.

Can I use SOCKS5 with Selenium?

Yes, without credentials. Whitelist your IP and use a socks5:// proxy server argument.

Why does Selenium ignore my proxy?

Check the argument format, make sure you're not also setting a conflicting system proxy, and confirm the driver started with your options.

Affiliate disclosure: Team of Monkeys is an affiliate of Geonode, Webshare and Rayobyte. Links and banners marked as sponsored, and links to Geonode, Webshare and Rayobyte in the text, use our referral links, and we may earn a commission if you buy through them, at no extra cost to you. Our explanations and comparisons are written to be useful whichever provider you choose.

Editorial note: Proxy providers change their pools, features and prices often, so treat any figures here as typical ranges at the time of writing and confirm current terms with the provider before you buy.