What is Selenium?

Selenium is an open-source browser automation framework used for web scraping, testing, and automating web interactions. While powerful, Selenium does not have built-in proxy support, making it essential to configure proxies separately for tasks like web scraping, ad verification, and accessing geo-restricted content.

Prerequisites

  • DataSea account with active subscription
  • Python 3.8+, Node.js 16+, or Java 11+
  • Selenium WebDriver installed
  • Chrome, Firefox, or Edge browser
  • ChromeDriver, GeckoDriver, or EdgeDriver

Setup guide

  1. 01

    Get your proxy credentials

    Sign in to your DataSea dashboard and navigate to the Credentials section. Copy your proxy username and password.

    text
    # DataSea Proxy Configuration
    Proxy Host: pr.datasea.io
    HTTP Port: 7011 (for http:// and https:// websites)
    HTTPS-to-proxy Port: 7010 (TLS between your client and the proxy)
    
    # Your credentials (from dashboard)
    Username: your_proxy_username
    Password: your_proxy_password
    
    # Proxy URL format (HTTP)
    http://username:password@pr.datasea.io:7011
    
    # Proxy URL with TLS to the proxy (for clients that support https:// proxy URLs)
    https://username:password@pr.datasea.io:7010
    
    # With geo-targeting (country in username)
    http://username_country-UnitedStates:password@pr.datasea.io:7011
    
    # With sticky session
    http://username_session-abc123:password@pr.datasea.io:7011
    
    # Combined targeting
    http://username_country-UnitedStates_session-abc123:password@pr.datasea.io:7011
  2. 02

    Install Selenium and Selenium Wire

    Install Selenium, Selenium Wire (adds proxy authentication to Selenium) and webdriver-manager. Selenium Wire needs blinker below 1.8.

    bash
    pip install selenium selenium-wire webdriver-manager "blinker<1.8"
  3. 03

    Configure the proxy in Selenium (Python)

    DataSea proxies always need your proxy username and password, and Chrome's --proxy-server flag cannot send them. Selenium Wire passes them for you.

    python
    from seleniumwire import webdriver
    from selenium.webdriver.chrome.service import Service
    from webdriver_manager.chrome import ChromeDriverManager
    
    # DataSea proxy with authentication
    # Optional targeting: your_username_country-UnitedStates_session-abc123
    PROXY_USER = "your_username"
    PROXY_PASS = "your_password"
    PROXY_HOST = "pr.datasea.io"
    PROXY_PORT = "7011"
    
    proxy_options = {
        'proxy': {
            'http': f'http://{PROXY_USER}:{PROXY_PASS}@{PROXY_HOST}:{PROXY_PORT}',
            'https': f'http://{PROXY_USER}:{PROXY_PASS}@{PROXY_HOST}:{PROXY_PORT}',
        }
    }
    
    # Initialize WebDriver with proxy
    driver = webdriver.Chrome(
        service=Service(ChromeDriverManager().install()),
        seleniumwire_options=proxy_options
    )
    
    # Verify proxy is working
    driver.get("https://httpbin.org/ip")
    print(driver.page_source)
    
    driver.quit()

Key features

Global coverage

Access 195+ countries with residential, datacenter, ISP, and mobile proxies.

Automatic rotation

Rotate IPs automatically per request or maintain sticky sessions up to 30 minutes.

High success rate

99%+ success rate with automatic retries and smart proxy selection.

Secure authentication

Username and password authentication through Selenium Wire.

Real-time analytics

Monitor usage, success rates, and bandwidth in your dashboard.

Geo-targeting

Target specific countries for localized scraping using username parameters.

Common use cases

Web scraping with rotating proxies

Scrape multiple pages using rotating residential proxies, so requests can exit from different IPs.

python
from seleniumwire import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
import time

# Configure rotating proxy (new IP each request)
PROXY_USER = "your_username"
PROXY_PASS = "your_password"

proxy_options = {
    'proxy': {
        'http': f'http://{PROXY_USER}:{PROXY_PASS}@pr.datasea.io:7011',
        'https': f'http://{PROXY_USER}:{PROXY_PASS}@pr.datasea.io:7011',
    }
}

driver = webdriver.Chrome(
    service=Service(ChromeDriverManager().install()),
    seleniumwire_options=proxy_options
)

urls = [
    "https://example.com/page1",
    "https://example.com/page2",
    "https://example.com/page3",
]

for url in urls:
    driver.get(url)
    title = driver.title
    print(f"Page: {url} | Title: {title}")
    time.sleep(2)

driver.quit()

Geo-targeted scraping (US)

Access US-specific content by adding country code to your username.

python
from seleniumwire import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager

# Target US proxies by adding _country-UnitedStates to username
PROXY_USER = "your_username_country-UnitedStates"  # <-- Country in username
PROXY_PASS = "your_password"

proxy_options = {
    'proxy': {
        'http': f'http://{PROXY_USER}:{PROXY_PASS}@pr.datasea.io:7011',
        'https': f'http://{PROXY_USER}:{PROXY_PASS}@pr.datasea.io:7011',
    }
}

driver = webdriver.Chrome(
    service=Service(ChromeDriverManager().install()),
    seleniumwire_options=proxy_options
)

# Access US-only content
driver.get("https://httpbin.org/ip")
print("Your US IP:", driver.page_source)

driver.quit()

Sticky sessions for login flows

Maintain the same IP address across multiple requests using session parameter in username.

python
from seleniumwire import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
import time

# Use sticky session by adding _session-ID to username
# Same session ID = same IP for the session duration
SESSION_ID = "login123"  # 1-32 letters or digits
PROXY_USER = f"your_username_country-UnitedStates_session-{SESSION_ID}"
PROXY_PASS = "your_password"

proxy_options = {
    'proxy': {
        'http': f'http://{PROXY_USER}:{PROXY_PASS}@pr.datasea.io:7011',
        'https': f'http://{PROXY_USER}:{PROXY_PASS}@pr.datasea.io:7011',
    }
}

driver = webdriver.Chrome(
    service=Service(ChromeDriverManager().install()),
    seleniumwire_options=proxy_options
)

# Login flow - all requests use same IP
driver.get("https://example.com/login")
driver.find_element(By.ID, "username").send_keys("user")
driver.find_element(By.ID, "password").send_keys("pass")
driver.find_element(By.ID, "submit").click()

time.sleep(2)

# Navigate authenticated pages with same IP
driver.get("https://example.com/dashboard")
print(driver.page_source)

driver.quit()

Troubleshooting

Proxy Authentication Failed

Solution: Verify your proxy username and password in the DataSea dashboard, including any _country- or _session- suffix. Pass them through Selenium Wire: the --proxy-server flag cannot carry credentials.

python
proxy_options = {
    'proxy': {
        'http': 'http://your_username:your_password@pr.datasea.io:7011',
        'https': 'http://your_username:your_password@pr.datasea.io:7011',
    }
}

driver = webdriver.Chrome(seleniumwire_options=proxy_options)

Connection Timeout

Solution: Increase page load timeout and verify proxy endpoint is accessible.

python
# Set longer timeout
driver.set_page_load_timeout(60)  # 60 seconds

# Also set implicit wait
driver.implicitly_wait(10)

# For Selenium Wire, configure timeout
proxy_options = {
    'proxy': {...},
    'connection_timeout': 30,
}

SSL Certificate Errors

Solution: Add options to ignore SSL certificate verification (for testing only).

python
chrome_options = Options()
chrome_options.add_argument("--ignore-certificate-errors")
chrome_options.add_argument("--ignore-ssl-errors")

# For Selenium Wire
proxy_options = {
    'proxy': {...},
    'verify_ssl': False,  # Use with caution
}

Proxy Not Working in Headless Mode

Solution: Ensure all required flags are set for headless Chrome, and keep the proxy in Selenium Wire.

python
chrome_options = Options()
chrome_options.add_argument("--headless=new")
chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument("--disable-dev-shm-usage")
chrome_options.add_argument("--disable-gpu")

# Keep the proxy in seleniumwire_options, not --proxy-server
driver = webdriver.Chrome(options=chrome_options, seleniumwire_options=proxy_options)

Get started with industry‑leading proxy access

Connect to 150M+ real IPs in seconds. Built for scale, privacy, and performance. Free trial available.