{"id":25407639,"url":"https://github.com/luminati-io/seleniumbase-with-proxy","last_synced_at":"2026-04-27T11:31:56.063Z","repository":{"id":277136846,"uuid":"931445201","full_name":"luminati-io/seleniumbase-with-proxy","owner":"luminati-io","description":"SeleniumBase with authenticated proxies to bypass restrictions, enhance web scraping, and manage rotating proxies for better data extraction.","archived":false,"fork":false,"pushed_at":"2025-02-12T09:59:00.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-04-13T13:38:58.718Z","etag":null,"topics":["data","data-collection","proxy-server","python","residential-proxy","selenium","seleniumwire","web-scraping"],"latest_commit_sha":null,"homepage":"https://brightdata.com/blog/proxy-101/seleniumbase-with-proxies","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/luminati-io.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-12T09:40:26.000Z","updated_at":"2025-02-12T09:59:03.000Z","dependencies_parsed_at":"2025-02-12T10:53:11.715Z","dependency_job_id":"105d94fd-2324-410d-ba12-ee38401dab9c","html_url":"https://github.com/luminati-io/seleniumbase-with-proxy","commit_stats":null,"previous_names":["luminati-io/seleniumbase-with-proxy"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/luminati-io/seleniumbase-with-proxy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luminati-io%2Fseleniumbase-with-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luminati-io%2Fseleniumbase-with-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luminati-io%2Fseleniumbase-with-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luminati-io%2Fseleniumbase-with-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luminati-io","download_url":"https://codeload.github.com/luminati-io/seleniumbase-with-proxy/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luminati-io%2Fseleniumbase-with-proxy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32335296,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T23:26:28.701Z","status":"online","status_checked_at":"2026-04-27T02:00:06.769Z","response_time":128,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data","data-collection","proxy-server","python","residential-proxy","selenium","seleniumwire","web-scraping"],"created_at":"2025-02-16T07:17:47.771Z","updated_at":"2026-04-27T11:31:56.048Z","avatar_url":"https://github.com/luminati-io.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Using Proxies With SeleniumBase\n\n[![Promo](https://github.com/luminati-io/Rotating-Residential-Proxies/blob/main/50%25%20off%20promo.png)](https://brightdata.com/proxy-types/residential-proxies) \n\nThis guide explains how to set up SeleniumBase with authenticated proxies to bypass restrictions and enhance your web scraping success.\n\n- [Why We Need SeleniumBase](#why-we-need-seleniumbase)\n- [Getting Started](#getting-started)\n- [Invoking The Test](#invoking-the-test)\n    - [Without a Proxy](#without-a-proxy)\n    - [Proxy Configuration](#proxy-configuration)\n    - [Running With a Proxy](#running-with-a-proxy)\n    - [Controlling Your Location](#controlling-your-location)\n    - [Rotating Proxies](#rotating-proxies)\n- [Conclusion](#conclusion)\n\n## Why We Need SeleniumBase\n\nSelenium doesn’t support authenticated proxies. Now that SeleniumWire has been deprecated for over a year already and hasn't had any updates in over two years, the solution is to use [SeleniumBase](https://seleniumbase.com/). The latter project was originally designed as a wrapper for running Selenium instances to perform web automation \u0026 testing with Python. However, for us, it allows running Selenium using an authenticated proxy.\n\n## Getting Started\n\nStart with installing SeleniumBase:\n\n```bash\npip install seleniumbase\n```\n\nNow write a test case that will control Selenium and run the webdriver instance. The code below makes a request to the [IPinfo API](https://ipinfo.io/json). Once the script receives the JSON response, it parses the response and prints its contents to the console.\n\n```python\nfrom seleniumbase import BaseCase\nfrom selenium.webdriver.common.by import By\nimport json\n\nclass ProxyTest(BaseCase):\n   def test_proxy(self):\n        #go to the site\n        self.driver.get(\"https://ipinfo.io/json\")\n      \n        #load the json response\n        location_info = json.loads(self.driver.find_element(By.TAG_NAME, \"body\").text)\n\n        #iterate through the dict and print its contents\n        for k,v in location_info.items():\n            print(f\"{k}: {v}\")\n```\n\n## Invoking The Test\n\nLet's run the test with `pytest` rather than with `python`.\n\n### Without a Proxy\n\nTo run the test script without a proxy, use the command below:\n\n```bash\npytest proxy_test.py -s\n```\n\nThe response will be similar to this one:\n\n```\n=================================================== test session starts ===================================================\nplatform linux -- Python 3.10.12, pytest-8.3.4, pluggy-1.5.0\nrootdir: /home/nultinator/clients/bright-data/seleniumbase-proxies\nplugins: 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\ncollected 1 item                                                                                                          \n\nproxy_test.py ip: 23.28.108.255\nhostname: d28-23-255-108.dim.wideopenwest.com\ncity: Westland\nregion: Michigan\ncountry: US\nloc: 42.3242,-83.4002\norg: AS12083 WideOpenWest Finance LLC\npostal: 48185\ntimezone: America/Detroit\nreadme: https://ipinfo.io/missingauth\n.\n\n==================================================== 1 passed in 1.01s ====================================================\n```\n\n### Proxy Configuration\n\nUse the `--proxy` flag followed by the proxy URL. Here is the template:\n\n```\n--proxy=your_proxy_url:your_proxy_port\n```\n\n#### Free Proxy\n\nThe following example uses a [free proxy](https://brightdata.com/solutions/free-proxies) from Bright Data. The IP address is `155.54.239.64`, and we’re talking to it on port `80`.\n\n```\n--proxy=155.54.239.64:80\n```\n\n#### Authenticated Proxy\n\nAuthenticated proxies are handled the same way. Simply include your username and password in the URL:\n\n```\nproxy=\u003cYOUR_USERNAME\u003e:\u003cYOUR_PASSWORD\u003e@\u003cPROXY_URL\u003e:\u003cPROXY_PORT\u003e\n```\n\n#### Authenticated Proxy Types\n\nThe best authenticated proxies options are:\n\n- [**Residential proxies**](https://brightdata.com/proxy-types/residential-proxies): use real user IPs which makes them ideal for bypassing bot detection.\n- [**Datacenter proxies**](https://brightdata.com/proxy-types/datacenter-proxies): faster and more cost-effective but easier to detect.\n- [**ISP proxies**](https://brightdata.com/proxy-types/isp-proxies): combine the benefits of both, offering speed with high trust levels.\n\n### Running With a Proxy\n\nThe example below is set up to run with one of our proxies at Bright Data. Be sure to replace the username, zone name, and password with your own credentials.\n\n```bash\npytest proxy_test.py --proxy=brd-customer-\u003cYOUR-USERNAME\u003e-zone-\u003cYOUR-ZONE-NAME\u003e:\u003cYOUR-PASSWORD\u003e@brd.superproxy.io:33335 -s\n```\n\nRunning it results in the following output:\n\n```\n=================================================== test session starts ===================================================\nplatform linux -- Python 3.10.12, pytest-8.3.4, pluggy-1.5.0\nrootdir: /home/nultinator/clients/bright-data/seleniumbase-proxies\nplugins: 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\ncollected 1 item\n\nproxy_test.py ip: 144.202.4.246\nhostname: 144-202-4-246.lum-int.io\ncity: Piscataway\nregion: New Jersey\ncountry: US\nloc: 40.4993,-74.3990\norg: AS20473 The Constant Company, LLC\npostal: 08854\ntimezone: America/New_York\nreadme: https://ipinfo.io/missingauth\n.\n\n==================================================== 1 passed in 3.25s ====================================================\n```\n\n### Controlling Your Location\n\nWith Bright Data's proxies, you can choose your location by using the `country` flag and a two-letter country code:\n\n```bash\npytest proxy_test.py --proxy=brd-customer-\u003cYOUR-USERNAME\u003e-zone-\u003cYOUR-ZONE-NAME\u003e:\u003cYOUR-PASSWORD\u003e-country-es@brd.superproxy.io:33335 -s\n```\n\nWhen you use `es` (Spain) as your country code, you get routed through a proxy in Spain. You can verify this in the output below.\n\n```\n=================================================== test session starts ===================================================\nplatform linux -- Python 3.10.12, pytest-8.3.4, pluggy-1.5.0\nrootdir: /home/nultinator/clients/bright-data/seleniumbase-proxies\nplugins: 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\ncollected 1 item\n\nproxy_test.py ip: 176.119.14.158\ncity: Paracuellos de Jarama\nregion: Madrid\ncountry: ES\nloc: 40.5035,-3.5278\norg: AS203020 HostRoyale Technologies Pvt Ltd\npostal: 28860\ntimezone: Europe/Madrid\nreadme: https://ipinfo.io/missingauth\n.\n\n==================================================== 1 passed in 3.98s ====================================================\n```\n\nPlease refer to the [geolocation documentation](https://docs.brightdata.com/api-reference/proxy/geolocation-targeting) for details.\n\n### Rotating Proxies\n\nThe code below uses a set of country codes, but these can easily be replaced with actual proxy IPs. `countries` holds the list of country codes. Next, we iterate through them and run our proxy test with all four country codes.\n\n- `us`: United States\n- `es`: Spain\n- `il`: Israel\n- `gb`: Great Britain\n\n```python\nimport subprocess\n\n#list of country codes\ncountries = [\n    \"us\",\n    \"es\",\n    \"il\",\n    \"gb\",\n]\n\n#iterate through the countries and make a shell command for each one\nfor country in countries:\n    command = f\"pytest proxy_test.py --proxy=brd-customer-\u003cYOUR-USERNAME\u003e-\u003cYOUR-ZONE-NAME\u003e-country-{country}:[email protected]:33335 -s\"\n\n    #run the shell command\n    subprocess.run(command, shell=True)\n```\n\nYou can run this as a regular Python file:\n\n```bash\npython rotate_proxies.py\n```\n\nThe output should be similar to this:\n\n```\n(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.)\n=================================================== test session starts ===================================================\nplatform linux -- Python 3.10.12, pytest-8.3.4, pluggy-1.5.0\nrootdir: /home/nultinator/clients/bright-data/seleniumbase-proxies\nplugins: 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\ncollected 1 item                                                                                                          \n\nproxy_test.py ip: 164.90.142.33\ncity: Clifton\nregion: New Jersey\ncountry: US\nloc: 40.8344,-74.1377\norg: AS14061 DigitalOcean, LLC\npostal: 07014\ntimezone: America/New_York\nreadme: https://ipinfo.io/missingauth\n.\n\n==================================================== 1 passed in 3.84s ====================================================\n(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.)\n=================================================== test session starts ===================================================\nplatform linux -- Python 3.10.12, pytest-8.3.4, pluggy-1.5.0\nrootdir: /home/nultinator/clients/bright-data/seleniumbase-proxies\nplugins: 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\ncollected 1 item                                                                                                          \n\nproxy_test.py ip: 5.180.9.15\ncity: Madrid\nregion: Madrid\ncountry: ES\nloc: 40.4066,-3.6724\norg: AS203020 HostRoyale Technologies Pvt Ltd\npostal: 28007\ntimezone: Europe/Madrid\nreadme: https://ipinfo.io/missingauth\n.\n\n==================================================== 1 passed in 3.60s ====================================================\n(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.)\n=================================================== test session starts ===================================================\nplatform linux -- Python 3.10.12, pytest-8.3.4, pluggy-1.5.0\nrootdir: /home/nultinator/clients/bright-data/seleniumbase-proxies\nplugins: 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\ncollected 1 item                                                                                                          \n\nproxy_test.py ip: 64.79.233.151\ncity: Tel Aviv\nregion: Tel Aviv\ncountry: IL\nloc: 32.0809,34.7806\norg: AS9009 M247 Europe SRL\ntimezone: Asia/Jerusalem\nreadme: https://ipinfo.io/missingauth\n.\n\n==================================================== 1 passed in 3.36s ====================================================\n(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.)\n=================================================== test session starts ===================================================\nplatform linux -- Python 3.10.12, pytest-8.3.4, pluggy-1.5.0\nrootdir: /home/nultinator/clients/bright-data/seleniumbase-proxies\nplugins: 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\ncollected 1 item                                                                                                          \n\nproxy_test.py ip: 185.37.3.107\ncity: London\nregion: England\ncountry: GB\nloc: 51.5085,-0.1257\norg: AS9009 M247 Europe SRL\npostal: E1W\ntimezone: Europe/London\nreadme: https://ipinfo.io/missingauth\n.\n\n==================================================== 1 passed in 2.90s ====================================================\n```\n\n## Conclusion\n\nSeleniumBase opens up many web scraping capabilities in Selenium. Unlock the full potential of Selenium-based scraping with Bright Data’s [industry-leading proxy services](https://brightdata.com/proxy-types). Start your free trial today!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluminati-io%2Fseleniumbase-with-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluminati-io%2Fseleniumbase-with-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluminati-io%2Fseleniumbase-with-proxy/lists"}