How to set up an authenticated proxy in Selenium WebDriver
Updated:
Standard ChromeDriver --proxy-server=http://ip:port flags ignore inline user:pass credentials and pop up a blocking login dialog. To use VinaProxy authenticated HTTP(S) proxies cleanly in Selenium, pass your credentials through selenium-wire or load a tiny Chrome onAuthRequired background extension.
http://user:pass@ip:port (selenium-wire / Chrome proxy extension)- 1 IP₫40,000
- 5+ IPs₫35,000
- 10+ IPs₫25,000
- 20+ IPs₫25,000
- 50+ IPs₫25,000
- 100+ IPs₫25,000
- 200+ IPs₫25,000
- 500+ IPs₫25,000
- 1000+ IPs₫22,000
- 2000+ IPs₫20,000
- 1 IP₫75,000
- 3+ IPs₫70,000
- 5+ IPs₫65,000
- 10+ IPs₫60,000
- 50+ IPs₫60,000
- 100+ IPs₫60,000
- 200+ IPs₫60,000
- 500+ IPs₫55,000
Two reliable ways to authenticate proxies in Selenium
Choose the approach that matches your language runtime and browser driver:
| Approach | Configuration Syntax | Best For |
|---|---|---|
selenium-wire (Python) | seleniumwire_options={'proxy': {'http': 'http://user:pass@ip:port', 'https': 'http://user:pass@ip:port'}} | Fastest Python setup; supports hot-swapping proxies mid-session |
| Chrome Auth Extension | Load a zipped extension handling chrome.webRequest.onAuthRequired | Standard Selenium across Python, Java, C#, and undetected-chromedriver |
| Migrate to Playwright | browser.newContext({ proxy: { server, username, password } }) | Native per-context proxy auth with zero extensions required |
Performance tips for Selenium scraping over proxies
- Set
options.page_load_strategy = 'eager'so WebDriver interacts as soon as the DOM is interactive without waiting for slow third-party trackers - Use
--headless=new(Chrome 109+) if running headless so Chrome extensions and proxy auth work identically to headed mode - Disable image rendering via Chrome preferences when scraping text-only product data
- Always wrap your driver in a
try / finally: driver.quit()block to prevent orphaned Chromium processes
Step by step
- 1
Install selenium-wire
Run
pip install selenium-wirein your Python virtual environment. - 2
Define your VinaProxy proxy dictionary
Format your credentials as
sw_options = {'proxy': {'http': 'http://user:pass@ip:port', 'https': 'http://user:pass@ip:port'}}. - 3
Launch webdriver.Chrome with seleniumwire_options
Initialize
driver = webdriver.Chrome(seleniumwire_options=sw_options). - 4
Verify the exit IP address
Navigate to
driver.get('https://vinaproxy.com/api/my-ip')and confirm the JSON response shows your proxy IP.
Frequently asked questions
Why doesn't `--proxy-server=http://user:pass@ip:port` work in ChromeOptions?
Chromium intentionally strips user:pass@ from the command-line --proxy-server flag. Using selenium-wire, an onAuthRequired extension, or Playwright solves this cleanly.
Can I switch proxies without restarting Chrome in selenium-wire?
Yes. Assign a new dictionary to driver.proxy = {'http': 'http://...', 'https': 'http://...'} at any point to switch the active upstream proxy on the fly.
Do Chrome proxy extensions work in headless mode?
Yes, as long as you pass --headless=new instead of the legacy --headless flag.
Run Selenium WebDriver at scale with unmetered static IPs
Instant Dedicated IPv4 and Static ISP proxies across 7 countries.
Buy Selenium Proxies