All systems operational HTTP · HTTPS · SOCKS5 Global network
Documentation home Quickstart Engineering guides Code examples Global network Pricing Solutions overview Custom proxy pools Managed data scraping Contact Console
CODE EXAMPLE

Authenticate Selenium traffic through LundProxy.

Authenticate Selenium traffic through LundProxy. This example uses Rotating Proxies as the default gateway and can be adapted by replacing endpoint and routing credentials.

LanguagePython 3.11+FrameworkSelenium WireGatewayRotating ProxiesFileselenium_proxy.py
01
SETUP

Install the client and create a file.

Use a clean project environment and pin tested dependency versions for production. The example target is a public scraping sandbox.

Installpython -m pip install selenium selenium-wire
02
CREDENTIALS

Load proxy secrets from the environment.

The proxy username is not the LundProxy website login. Copy the complete username and password generated for the selected proxy product.

PROXY_USER=user-pool-crawlerPROXY_PASS=your-secret
03
COMPLETE EXAMPLE

selenium_proxy.py

Copy the code into the named file, set credentials, and run it from the project environment.

import os
from seleniumwire import webdriver
from selenium.webdriver.common.by import By

proxy = (
    "http://"
    f"{os.environ['PROXY_USER']}:{os.environ['PROXY_PASS']}"
    "@proxy.lundproxy.com:36923"
)

options = webdriver.ChromeOptions()
options.add_argument("--headless=new")

driver = webdriver.Chrome(
    options=options,
    seleniumwire_options={
        "proxy": {"http": proxy, "https": proxy, "no_proxy": "localhost"},
    },
)

try:
    driver.set_page_load_timeout(30)
    driver.get("https://quotes.toscrape.com/js/")
    print(len(driver.find_elements(By.CSS_SELECTOR, ".quote")))
finally:
    driver.quit()
04
WHAT THE EXAMPLE DOES

Keep the important behavior visible.

01Authenticated proxy settings are explicit.
02Page load timeout is bounded.
03The driver closes in finally.
04Use a controlled dependency version in production.
05
PRODUCTION NOTES

Add workload-specific controls before scale.

A successful sandbox run proves integration, not production readiness.

Test representative targets, response sizes, routing policy, concurrency, retries, validation, and completion window. Collect only public data you are authorized to access.

06
EXAMPLE FAQ

Selenium Wire questions.

Why use Selenium Wire?

It provides authenticated upstream proxy configuration around Selenium traffic.

Can I use a plain Chrome flag?

A proxy-server flag alone does not reliably solve authenticated proxy credentials in every Chrome setup.

What should I pin?

Pin Selenium, Selenium Wire, browser, and driver versions in a tested environment.