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.
Sign in to your DataSea dashboard and navigate to the Credentials section. Copy your proxy username and password.
# 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:7011Install Selenium, Selenium Wire (adds proxy authentication to Selenium) and webdriver-manager. Selenium Wire needs blinker below 1.8.
pip install selenium selenium-wire webdriver-manager "blinker<1.8"DataSea proxies always need your proxy username and password, and Chrome's --proxy-server flag cannot send them. Selenium Wire passes them for you.
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()Access 195+ countries with residential, datacenter, ISP, and mobile proxies.
Rotate IPs automatically per request or maintain sticky sessions up to 30 minutes.
99%+ success rate with automatic retries and smart proxy selection.
Username and password authentication through Selenium Wire.
Monitor usage, success rates, and bandwidth in your dashboard.
Target specific countries for localized scraping using username parameters.
Scrape multiple pages using rotating residential proxies, so requests can exit from different IPs.
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()Access US-specific content by adding country code to your username.
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()Maintain the same IP address across multiple requests using session parameter in username.
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()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.
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)Solution: Increase page load timeout and verify proxy endpoint is accessible.
# 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,
}Solution: Add options to ignore SSL certificate verification (for testing only).
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
}Solution: Ensure all required flags are set for headless Chrome, and keep the proxy in Selenium Wire.
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)Official Selenium WebDriver documentation
documentationSelenium Wire for proxy authentication support
documentationComplete DataSea proxy API documentation
documentationStep-by-step video tutorial for Selenium scraping
videoConnect to 150M+ real IPs in seconds. Built for scale, privacy, and performance. Free trial available.