---
title: "How to Use Proxies With SeleniumBase"
slug: seleniumbase-with-proxies
date: 2025-02-05T11:53:38+00:00
modified: 2025-09-16T16:37:37+00:00
permalink: https://brightdata.com/blog/proxy-101/seleniumbase-with-proxies
type: blog
---

[ Blog ](https://brightdata.com/blog "Blog") / [Proxy 101](https://brightdata.com/blog/proxy-101)







 [Proxy 101](https://brightdata.com/blog/proxy-101)

# How to Use Proxies With SeleniumBase

Set up SeleniumBase with authenticated proxies to bypass restrictions and enhance your web scraping success.

 7 min read





 [ ](https://brightdata.com/blog/authors/jake-nulty)

 [Jake Nulty

Technical Writer

 ](https://brightdata.com/blog/authors/jake-nulty)





 ![How to Use Proxies With SeleniumBase blog image](https://media.brightdata.com/2025/02/How-to-Use-Proxies-With-SeleniumBase-blog-image.svg)





[SeleniumBase](https://seleniumbase.com/) is designed as a wrapper for running Selenium instances in a testing environment. That said, it’s far more than just a wrapper. SeleniumBase allows us to run Selenium using an authenticated proxy.

## Inherent Proxy Problems With Selenium

Selenium doesn’t have very good proxy support. While you can pass a `--proxy-server` argument into Selenium, there is no support for authenticated proxies. It gets worse though. For years, [SeleniumWire](/blog/web-data/web-scraping-with-selenium-wire) was the go to option when using proxies with Selenium. Integration was incredibly easy. Sadly, SeleniumWire was deprecated over a year ago and hasn’t received any updates in over two years.

## <a></a>Getting Started

To get started, we need to install SeleniumBase and write a test case. The test case is what actually controls Selenium and runs our webdriver instance for us.

### <a></a>Installation

```none
pip install seleniumbase

```

### <a></a>Writing a Test Case

Here’s a simple test case. The code below makes a request to the [IPinfo API](https://ipinfo.io/json). Once we receive our JSON response, we parse it and print its contents to the console.

```none
from seleniumbase import BaseCase
from selenium.webdriver.common.by import By
import json

class ProxyTest(BaseCase):
   def test_proxy(self):
        #go to the site
        self.driver.get("https://ipinfo.io/json")

        #load the json response
        location_info = json.loads(self.driver.find_element(By.TAG_NAME, "body").text)

        #iterate through the dict and print its contents
        for k,v in location_info.items():
            print(f"{k}: {v}")

```

## <a></a>Invoking The Test

In order to actually run the code, we need to run the test. Instead of using `python name_of_your_script.py`, we’re actually going to use `pytest`.

### <a></a>Without a Proxy

If you wish to run your test script without a proxy, you can use the command below.

```none
pytest proxy_test.py -s

```

You’ll receive a response similar to this.

```none
=================================================== test session starts ===================================================
platform linux -- Python 3.10.12, pytest-8.3.4, pluggy-1.5.0
rootdir: /home/nultinator/clients/bright-data/seleniumbase-proxies
plugins: html-4.0.2, metadata-3.1.1, anyio-4.0.0, seleniumbase-4.34.6, ordering-0.6, rerunfailures-15.0, xdist-3.6.1
collected 1 item

proxy_test.py ip: 23.28.108.255
hostname: d28-23-255-108.dim.wideopenwest.com
city: Westland
region: Michigan
country: US
loc: 42.3242,-83.4002
org: AS12083 WideOpenWest Finance LLC
postal: 48185
timezone: America/Detroit
readme: https://ipinfo.io/missingauth
.

==================================================== 1 passed in 1.01s ====================================================

```

### <a></a>Proxy Configuration

To use a proxy, we simply need to use the `--proxy` flag followed by our proxy url. Look at the format below.

```none
--proxy=your_proxy_url:your_proxy_port

```

#### <a></a>Free Proxy

Here’s an example using a [free proxy](/solutions/free-proxies). The IP address is `155.54.239.64` and we’re talking to it on port `80`.

```none
--proxy=155.54.239.64:80

```

#### <a></a>Authenticated Proxy

Authenticated proxies are handled the same way. With an authenticated proxy, you simply need to include your username and password in the url.

```none
proxy=<YOUR_USERNAME>:<YOUR_PASSWORD>@<PROXY_URL>:<PROXY_PORT>

```

#### Best Authenticated Proxy Types and Providers

When using authenticated proxies with Selenium, the best options are [residential proxies](/proxy-types/residential-proxies), [datacenter proxies](/proxy-types/datacenter-proxies), and [ISP proxies](/proxy-types/isp-proxies), each offering different levels of anonymity and reliability. Residential proxies provide the highest success rates by using real user IPs, making them ideal for bypassing bot detection. Datacenter proxies are faster and more cost-effective but easier to detect. ISP proxies combine the benefits of both, offering speed with high trust levels.

**Recommended Providers:**

- geo-targeting
- Rotating proxies

For [SeleniumBase scraping](/blog/web-data/web-scraping-with-seleniumbase), Bright Data’s residential proxies are the most reliable option, ensuring high success rates and minimal blocks.

### <a></a>Running With a Proxy

The example below is configured to run with one of our proxies here at Bright Data. Make sure to replace the username, zone name, and password with your own.

```none
pytest proxy_test.py --proxy=brd-customer-<YOUR-USERNAME>-zone-<YOUR-ZONE-NAME>:<YOUR-PASSWORD>@brd.superproxy.io:33335 -s

```

When we run it we get the following output. If you look closely, you’ll see that our location has changed.

```none
=================================================== test session starts ===================================================
platform linux -- Python 3.10.12, pytest-8.3.4, pluggy-1.5.0
rootdir: /home/nultinator/clients/bright-data/seleniumbase-proxies
plugins: html-4.0.2, metadata-3.1.1, anyio-4.0.0, seleniumbase-4.34.6, ordering-0.6, rerunfailures-15.0, xdist-3.6.1
collected 1 item

proxy_test.py ip: 144.202.4.246
hostname: 144-202-4-246.lum-int.io
city: Piscataway
region: New Jersey
country: US
loc: 40.4993,-74.3990
org: AS20473 The Constant Company, LLC
postal: 08854
timezone: America/New_York
readme: https://ipinfo.io/missingauth
.

==================================================== 1 passed in 3.25s ====================================================

```

### <a></a>Controlling Your Location

With our proxies, you can even choose your location. You can do this by using the `country` flag. Each country has a two letter country code that you can pass into the proxy.

```none
pytest proxy_test.py --proxy=brd-customer-<YOUR-USERNAME>-zone-<YOUR-ZONE-NAME>:<YOUR-PASSWORD><a class="__cf_email__" data-cfemail="4f622c203a213b3d36622a3c0f2d3d2b613c3a3f2a3d3f3d203736612620" href="/cdn-cgi/l/email-protection">[email protected]</a>:33335 -s

```

When you use `es` (Spain) as your country code, you get routed through a proxy in Spain. You can verify this in the output below.

```none
=================================================== test session starts ===================================================
platform linux -- Python 3.10.12, pytest-8.3.4, pluggy-1.5.0
rootdir: /home/nultinator/clients/bright-data/seleniumbase-proxies
plugins: html-4.0.2, metadata-3.1.1, anyio-4.0.0, seleniumbase-4.34.6, ordering-0.6, rerunfailures-15.0, xdist-3.6.1
collected 1 item

proxy_test.py ip: 176.119.14.158
city: Paracuellos de Jarama
region: Madrid
country: ES
loc: 40.5035,-3.5278
org: AS203020 HostRoyale Technologies Pvt Ltd
postal: 28860
timezone: Europe/Madrid
readme: https://ipinfo.io/missingauth
.

==================================================== 1 passed in 3.98s ====================================================

```

You can view our geolocation docs [here](https://docs.brightdata.com/api-reference/proxy/geolocation-targeting).

### <a></a>Rotating Proxies

With only the basics of Python, you can make a pretty good proxy system. In the code below, we use a set of country codes, but these can easily be replaced with actual proxy IPs. `countries` holds our list of country codes. We then iterate through them and run our proxy test using all four country codes.

- `us`: United States
- `es`: Spain
- `il`: Israel
- `gb`: Great Britain

```none
import subprocess

#list of country codes
countries = [
    "us",
    "es",
    "il",
    "gb",
]

#iterate through the countries and make a shell command for each one
for country in countries:
    command = f"pytest proxy_test.py --proxy=brd-customer-<YOUR-USERNAME>-<YOUR-ZONE-NAME>-country-{country}:<a class="__cf_email__" data-cfemail="a6cc909296c8cc94cbd194c8cce6c4d4c288d5d3d6c3d4d6d4c9dedf88cfc9" href="/cdn-cgi/l/email-protection">[email protected]</a>:33335 -s"

    #run the shell command
    subprocess.run(command, shell=True)

```

You can run this as a regular Python file.

```none
python rotate_proxies.py

```

When you run the code, you should receive output similar to this.

```none
(Linux uses --headless by default. To override, use --headed / --gui. For Xvfb mode instead, use --xvfb. Or you can hide this info by using --headless / --headless2 / --uc.)
=================================================== test session starts ===================================================
platform linux -- Python 3.10.12, pytest-8.3.4, pluggy-1.5.0
rootdir: /home/nultinator/clients/bright-data/seleniumbase-proxies
plugins: html-4.0.2, metadata-3.1.1, anyio-4.0.0, seleniumbase-4.34.6, ordering-0.6, rerunfailures-15.0, xdist-3.6.1
collected 1 item

proxy_test.py ip: 164.90.142.33
city: Clifton
region: New Jersey
country: US
loc: 40.8344,-74.1377
org: AS14061 DigitalOcean, LLC
postal: 07014
timezone: America/New_York
readme: https://ipinfo.io/missingauth
.

==================================================== 1 passed in 3.84s ====================================================
(Linux uses --headless by default. To override, use --headed / --gui. For Xvfb mode instead, use --xvfb. Or you can hide this info by using --headless / --headless2 / --uc.)
=================================================== test session starts ===================================================
platform linux -- Python 3.10.12, pytest-8.3.4, pluggy-1.5.0
rootdir: /home/nultinator/clients/bright-data/seleniumbase-proxies
plugins: html-4.0.2, metadata-3.1.1, anyio-4.0.0, seleniumbase-4.34.6, ordering-0.6, rerunfailures-15.0, xdist-3.6.1
collected 1 item

proxy_test.py ip: 5.180.9.15
city: Madrid
region: Madrid
country: ES
loc: 40.4066,-3.6724
org: AS203020 HostRoyale Technologies Pvt Ltd
postal: 28007
timezone: Europe/Madrid
readme: https://ipinfo.io/missingauth
.

==================================================== 1 passed in 3.60s ====================================================
(Linux uses --headless by default. To override, use --headed / --gui. For Xvfb mode instead, use --xvfb. Or you can hide this info by using --headless / --headless2 / --uc.)
=================================================== test session starts ===================================================
platform linux -- Python 3.10.12, pytest-8.3.4, pluggy-1.5.0
rootdir: /home/nultinator/clients/bright-data/seleniumbase-proxies
plugins: html-4.0.2, metadata-3.1.1, anyio-4.0.0, seleniumbase-4.34.6, ordering-0.6, rerunfailures-15.0, xdist-3.6.1
collected 1 item

proxy_test.py ip: 64.79.233.151
city: Tel Aviv
region: Tel Aviv
country: IL
loc: 32.0809,34.7806
org: AS9009 M247 Europe SRL
timezone: Asia/Jerusalem
readme: https://ipinfo.io/missingauth
.

==================================================== 1 passed in 3.36s ====================================================
(Linux uses --headless by default. To override, use --headed / --gui. For Xvfb mode instead, use --xvfb. Or you can hide this info by using --headless / --headless2 / --uc.)
=================================================== test session starts ===================================================
platform linux -- Python 3.10.12, pytest-8.3.4, pluggy-1.5.0
rootdir: /home/nultinator/clients/bright-data/seleniumbase-proxies
plugins: html-4.0.2, metadata-3.1.1, anyio-4.0.0, seleniumbase-4.34.6, ordering-0.6, rerunfailures-15.0, xdist-3.6.1
collected 1 item

proxy_test.py ip: 185.37.3.107
city: London
region: England
country: GB
loc: 51.5085,-0.1257
org: AS9009 M247 Europe SRL
postal: E1W
timezone: Europe/London
readme: https://ipinfo.io/missingauth
.

==================================================== 1 passed in 2.90s ====================================================

```

As you can see, with a very small amount of code, we’re controlling proxies in the US, Spain, Israel, and Great Britain.

## <a></a>Conclusion

When scraping the web, SeleniumBase opens up capabilities in Selenium that many people find impossible. Throughout this guide, you’ve learned how to configure proxies, control your geolocation, and even rotate proxies. These tools will help you get past most of the blocking mechanisms that come your way.

Unlock the full potential of Selenium-based scraping with Bright Data’s [industry-leading proxy services](/proxy-types). Start your free trial today and experience seamless, reliable data collection at scale!



Start free trial[Start free with Google](# "Start free with Google")









 [ ](https://www.linkedin.com/in/jacob-nulty-682803187/)

Jake Nulty

 Technical Writer



  6 years experience



Jacob Nulty is a Detroit-based software developer and technical writer exploring AI and human philosophy, with experience in Python, Rust, and blockchain.



Expertise

  Data Structures   Python   Rust



 [ View all articles ](https://brightdata.com/blog/authors/jake-nulty)











 Table of Contents







400M+ Residential Proxies

**Get 50% off** on residential proxies for 6 months! Use code **RESIGB50**.

[See pricing](/pricing/proxy-network/residential-proxies "See pricing")

1.3M+ Datacenter Proxies

Pay only for the IP, starting from $0.90.

[See pricing](/pricing/proxy-network/datacenter-proxies "See pricing")







 [ ](https://news.ycombinator.com/submitlink?t=How+to+Use+Proxies+With+SeleniumBase&u=https://brightdata.com/blog/proxy-101/seleniumbase-with-proxies) [ ](https://www.linkedin.com/shareArticle?mini=true&title=How+to+Use+Proxies+With+SeleniumBase&url=https://brightdata.com/blog/proxy-101/seleniumbase-with-proxies) [ ](http://www.reddit.com/submit?title=How+to+Use+Proxies+With+SeleniumBase&url=https://brightdata.com/blog/proxy-101/seleniumbase-with-proxies)







##  You might also be interested in

 [ ](https://brightdata.com/blog/ai/openhuman-with-bright-data "Production-Ready Web Access in OpenHuman Through the Bright Data CLI")

 [AI





Antonello Zanini

Technical Writer





### Production-Ready Web Access in OpenHuman Through the Bright Data CLI

Integrate Bright Data CLI with OpenHuman to enable production-ready web access and data collection for AI agents.



 09-Sep-2026

 12 min read

 ](https://brightdata.com/blog/ai/openhuman-with-bright-data)

 [ ](https://brightdata.com/blog/ai/minimax-m3-with-bright-data "Giving self-hosted MiniMax M3 agents live web access with Bright Data")

 [AI





Satyam Tripathi

Technical Writer





### Giving self-hosted MiniMax M3 agents live web access with Bright Data

Self-hosted MiniMax M3 agents get live web access using Bright Data’s search and scraping tools. Bypass blocks and CAPTCHAs.



 09-Sep-2026

 54 min read

 ](https://brightdata.com/blog/ai/minimax-m3-with-bright-data)

 [ ](https://brightdata.com/blog/web-data/multimodal-web-scraping-with-minimax "Multimodal Web Scraping with MiniMax")

 [Web Data





Antonello Zanini

Technical Writer





### Multimodal Web Scraping with MiniMax

Pair Bright Data Web Unlocker with MiniMax M3 vision to extract structured data from images and web page screenshots.



 09-Sep-2026

 4 min read

 ](https://brightdata.com/blog/web-data/multimodal-web-scraping-with-minimax)
