Selenium Integration

Selenium WebDriver proxy setup: Python, Java, Node.js — one residential IP config

BytesFlows residential proxies work with all Selenium language bindings via ChromeOptions or FirefoxOptions. No third-party library — standard WebDriver capability injection at browser launch.

Selenium proxy configuration across languages

BytesFlows uses standard HTTP proxy settings compatible with all WebDriver implementations.

selenium_proxy.py
from selenium import webdriver
from selenium.webdriver.chrome.options import Options

PROXY_HOST = 'p1.bytesflows.com'
PROXY_PORT = 8001
PROXY_USER = 'YOUR_USER'
PROXY_PASS = 'YOUR_PASS'

options = Options()
options.add_argument(f'--proxy-server=http://{PROXY_HOST}:{PROXY_PORT}')
# Note: Chrome doesn't support proxy auth via args directly
# Use a proxy extension or the manual approach below for auth

driver = webdriver.Chrome(options=options)

# For authenticated proxy, use CDP command:
driver.execute_cdp_cmd('Network.setExtraHTTPHeaders', {
    'headers': {
        'Proxy-Authorization': 'Basic ' + __import__('base64')
            .b64encode(f'{PROXY_USER}:{PROXY_PASS}'.encode())
            .decode()
    }
})

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

Chrome does not support proxy authentication via command-line args. Use CDP Network.setExtraHTTPHeaders to inject the Proxy-Authorization header, or use a proxy extension (see seleniumwire approach).

How Selenium routes requests through BytesFlows

Selenium delegates all network requests to the underlying browser engine, which respects proxy configuration set via ChromeOptions or FirefoxOptions.

🤖

WebDriver script

Python/Java/Node.js script launches the browser with proxy options via ChromeOptions or FirefoxOptions.

🌐

Browser engine

Chrome or Firefox reads the --proxy-server flag and routes all page requests through the configured proxy.

🔐

BytesFlows gateway

Gateway authenticates the request using sub-user credentials and selects a residential node matching the geo parameters.

🏠

Residential exit

All page requests exit through a real home broadband IP. The target site sees organic residential traffic.

Selenium 4+ supports CDP (Chrome DevTools Protocol) directly — use it for proxy authentication injection without external libraries.

Selenium proxy technical FAQ

Why does Chrome in Selenium not authenticate the proxy via --proxy-server?
Chrome's --proxy-server command-line flag sets the proxy server but doesn't support including credentials in the URL. Authentication must be handled separately: via CDP Network.setExtraHTTPHeaders (Selenium 4+), a Chrome extension that intercepts auth challenges, or the seleniumwire library which handles this automatically.
Which is better for proxy auth in Selenium: CDP or seleniumwire?
seleniumwire is easier to set up — one dict with proxy URLs. CDP is more low-level but works without additional dependencies. Use seleniumwire for Python projects where simplicity matters. Use CDP for Java/C# where seleniumwire is not available.
Does Selenium Grid support per-node proxy configuration?
Yes. In Selenium Grid, each node can be configured with its own proxy settings. Pass proxy capabilities in the DesiredCapabilities or ChromeOptions when creating sessions via the Grid Hub. This allows different Grid nodes to route through different BytesFlows geo targets.
Can I use BytesFlows with undetected-chromedriver?
Yes. undetected-chromedriver (uc.Chrome) accepts ChromeOptions the same way as regular Selenium Chrome. Add --proxy-server to uc.ChromeOptions and inject auth via CDP. undetected-chromedriver patches browser detection signals — combined with BytesFlows residential IPs, this provides strong anti-detection coverage.

Upgrade your Selenium scripts with residential IPs

1 GB free — test all four code examples above without any cost.