Option 1: IP whitelisting (recommended for servers)#
Submit the server’s actual outbound public IPv4 in Access and wait for administrator activation. NAT or a VPN may change the address seen by the gateway. Password-free access works only after the entry is confirmed for the assigned service. Confirm country and session options separately; a source-IP allowlist does not send username parameters. whitelist
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
opts = Options()
opts.add_argument("--proxy-server=http://res.proxy-cyber.com:9000")
opts.add_argument("--headless=new")
driver = webdriver.Chrome(options=opts)
driver.get("https://api.ipify.org")
print(driver.find_element("tag name", "body").text)
driver.quit()Option 2: WebDriver BiDi authentication #
The example uses Selenium’s maintained WebDriver BiDi API, with enable_bidi and network.add_auth_handler. Test an HTTP proxy challenge with the installed browser and driver before using it in a job. The handler is not restricted to one host, so use an isolated browser session without unrelated authentication prompts. If proxy authentication is unsupported in your version combination, use an activated IP allowlist.
import os
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = Options()
options.enable_bidi = True
options.add_argument("--proxy-server=" + os.environ["PROXY_SERVER"])
with webdriver.Chrome(options=options) as driver:
handler = driver.network.add_auth_handler(
os.environ["PROXY_USER"], os.environ["PROXY_PASSWORD"]
)
try:
driver.get("https://api.ipify.org")
print(driver.find_element("tag name", "body").text)
finally:
driver.network.remove_auth_handler(handler)Firefox#
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
opts = Options()
opts.set_preference("network.proxy.type", 1)
opts.set_preference("network.proxy.http", "res.proxy-cyber.com")
opts.set_preference("network.proxy.http_port", 9000)
opts.set_preference("network.proxy.ssl", "res.proxy-cyber.com")
opts.set_preference("network.proxy.ssl_port", 9000)
opts.set_preference("media.peerconnection.enabled", False) # no WebRTC leak
driver = webdriver.Firefox(options=opts) # whitelisted server, no promptPractical rules#
- Use a distinct session identifier for each independent workflow, where the assigned gateway supports it. Confirm the permitted duration and location parameters in your connection details. A residential device can disconnect before the requested duration; a sticky session is not a guarantee of the same IP for days. For a fixed address, compare a dedicated static product.
- Use
--headless=newin Chrome; the old headless mode has a distinctive fingerprint. - Separate session identifiers isolate routing preferences, not the browser’s cookies or application state. Start with a small number of workers, measure errors and traffic, and increase gradually within the limits confirmed for your order and the destination. A narrow city or carrier selection can reduce available capacity.
Questions people ask#
Why does Chrome show a proxy login prompt with Selenium?
Use an activated source-IP allowlist for a fixed server, or test Selenium’s current WebDriver BiDi authentication handler with the installed browser. Do not rely on an archived Selenium Wire installation for a new integration.