Tutorials9 min read

Selenium Proxy Configuration: Python Tutorial

How to configure proxies in Selenium WebDriver for browser automation.

OutreachProxy Team

Proxy Experts

Selenium Proxy Setup

Configure proxies in Selenium for automated browser testing and scraping.

TL;DR: Use Chrome Options to set proxy settings, then pass to WebDriver. For authenticated proxies, use extensions or wire protocol.

Basic Chrome Setup

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

proxy = "proxy.outreachproxy.com:8080"

chrome_options = Options() chrome_options.add_argument(f'--proxy-server=http://{proxy}')

driver = webdriver.Chrome(options=chrome_options) driver.get('https://httpbin.org/ip')

With Authentication (selenium-wire)

pip install selenium-wire

from seleniumwire import webdriver

proxy_options = { 'proxy': { 'http': 'http://username:password@proxy.outreachproxy.com:8080', 'https': 'http://username:password@proxy.outreachproxy.com:8080' } }

driver = webdriver.Chrome(seleniumwire_options=proxy_options) driver.get('https://httpbin.org/ip')

Firefox Setup

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

profile = webdriver.FirefoxProfile() profile.set_preference("network.proxy.type", 1) profile.set_preference("network.proxy.http", "proxy.outreachproxy.com") profile.set_preference("network.proxy.http_port", 8080) profile.set_preference("network.proxy.ssl", "proxy.outreachproxy.com") profile.set_preference("network.proxy.ssl_port", 8080)

driver = webdriver.Firefox(firefox_profile=profile)

Best Practices

1. Handle proxy errors gracefully 2. Implement retry logic 3. Close drivers properly 4. Use headless mode when appropriate

SeleniumPythonbrowser automation

Written by OutreachProxy Team

Proxy Experts

The OutreachProxy team helps businesses scale their cold outreach with reliable static residential proxies. We share our expertise to help you succeed.

Ready to Scale Your Outreach?

Get started with static residential proxies built for cold outreach professionals. From $2.97/month with unlimited bandwidth.

Get Started