# Selenium Proxy: Chrome and Firefox With a Static ISP IP | ProxyJam

How to set a proxy in Selenium for Chrome and Firefox, why credentials in --proxy-server fail, and how IP whitelisting replaces them. Tested Python code.

- Canonical: https://proxyjam.com/integrations/selenium/
- Updated: 2026-10-22
- Language: en

Run Chrome or Firefox under Selenium through one static ISP address. Every sample on this page was run against a local proxy before it was published, and what did not work is said plainly.


In Chrome, pass `--proxy-server=http://HOST:PORT` as an argument; in Firefox, set a manual Proxy on the options. Firefox can answer the proxy's password prompt through Selenium's WebDriver BiDi handler, `add_authentication_handler`. Chrome could not in our test: it ignores credentials in `--proxy-server`, and both BiDi handlers timed out. For Chrome, put the IP your tests run from on the proxy's whitelist, and the proxy needs no credentials, over HTTP or SOCKS5.


## Set a proxy in Selenium

1. **Find the public IP your tests run from** The address of the machine or CI runner as the internet sees it, not its local one. [What Is My IP](/what-is-my-ip/) shows it.
2. **Put that IP on the proxy's whitelist** One API call, `PUT /orders/ORDER_ID/whitelist`, or the `set_proxy_whitelist` tool of the MCP server; the dashboard has no control for it yet. The whitelist takes IPv4 addresses and replaces the list each time. While a whitelist is set, the proxy admits only the listed addresses and the username and password stop working for that order; sending an empty list turns the whitelist off and password login works again.
3. **Copy the host and port from the order** From My Proxies or the API. With the whitelist in place, the username and password are not needed.
4. **Set the proxy on the browser options** Chrome: `--proxy-server=http://HOST:PORT`, or `socks5://HOST:PORT` after switching the proxy to SOCKS5. Firefox: a manual `Proxy` with `httpProxy` and `sslProxy`.
5. **Open a page and check the exit address** Load What Is My IP in the driven browser once and confirm it shows the address you bought, then run the suite.

## Tested code for Selenium 4 in Python

The Firefox password sample sends a username and password, so it needs an order with no whitelist set. The other browser samples assume your machine's IP is on the proxy's whitelist; the SOCKS5 one also needs the proxy switched to SOCKS5 first, which gives a new port. Replace the capitals with your order's values, and ORDER_ID, YOUR_API_KEY and YOUR_IP in the whitelist call.

### Chrome

Chrome through an HTTP proxy.

```
# The proxy has your machine's IP on its whitelist, so no credentials
# are sent: Chrome ignores them in --proxy-server anyway.
from selenium import webdriver

options = webdriver.ChromeOptions()
options.add_argument("--headless=new")  # remove to watch the browser
options.add_argument("--proxy-server=http://HOST:PORT")

driver = webdriver.Chrome(options=options)
try:
    driver.get("https://example.com/")
    print(driver.title)
finally:
    driver.quit()
```

### Firefox password

Firefox answering the proxy's password prompt.

```
# Selenium 4.51+ with WebDriver BiDi; pip install selenium
from selenium import webdriver
from selenium.webdriver.common.proxy import Proxy, ProxyType

options = webdriver.FirefoxOptions()
options.enable_bidi = True
options.add_argument("-headless")  # remove to watch the browser
options.proxy = Proxy({
    "proxyType": ProxyType.MANUAL,
    "httpProxy": "HOST:PORT",
    "sslProxy": "HOST:PORT",
})

driver = webdriver.Firefox(options=options)
try:
    # Answers the proxy's 407 with your username and password
    driver.network.add_authentication_handler(
        lambda request: request.provide_credentials("USERNAME", "PASSWORD")
    )
    driver.get("https://example.com/")
    print(driver.title)
finally:
    driver.quit()
```

### Firefox

Firefox through a whitelisted HTTP proxy.

```
# The proxy has your machine's IP on its whitelist, so no credentials
# are sent. For a password instead, see selenium-firefox-auth.
from selenium import webdriver
from selenium.webdriver.common.proxy import Proxy, ProxyType

options = webdriver.FirefoxOptions()
options.add_argument("-headless")  # remove to watch the browser
options.proxy = Proxy({
    "proxyType": ProxyType.MANUAL,
    "httpProxy": "HOST:PORT",
    "sslProxy": "HOST:PORT",
})

driver = webdriver.Firefox(options=options)
try:
    driver.get("https://example.com/")
    print(driver.title)
finally:
    driver.quit()
```

### Chrome SOCKS5

Chrome through a SOCKS5 proxy.

```
# Switch the proxy to SOCKS5 first, then use the port the order shows.
# The whitelist applies to SOCKS5 as well, so no credentials here either.
from selenium import webdriver

options = webdriver.ChromeOptions()
options.add_argument("--headless=new")  # remove to watch the browser
options.add_argument("--proxy-server=socks5://HOST:PORT")

driver = webdriver.Chrome(options=options)
try:
    driver.get("https://example.com/")
    print(driver.title)
finally:
    driver.quit()
```

### Whitelist call

Add your IP to the proxy's whitelist.

```
# Put the public IPv4 address your code runs from on the proxy's
# whitelist. Replaces the list; an empty list turns whitelisting off
# and the proxy falls back to username and password.
curl -X PUT "https://api.proxyjam.com/public/v1/orders/ORDER_ID/whitelist" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"whitelisted_ips": ["YOUR_IP"]}'
```


## Proxy options in Selenium, browser by browser

|  | HTTP proxy | SOCKS5 proxy | Username and password |
|---|---|---|---|
| Chrome | --proxy-server=http://HOST:PORT | --proxy-server=socks5://HOST:PORT | Ignored in --proxy-server; use the whitelist |
| Firefox | Proxy with httpProxy and sslProxy | Proxy with socksProxy and socksVersion 5 | Worked through add_authentication_handler (BiDi), over HTTP |
| Chrome, BiDi handlers | add_auth_handler and add_authentication_handler both timed out | Not tested | Use the whitelist until a later Selenium or Chrome changes this |

Tested on 2026-10-22 with Selenium 4.51, Chrome and Firefox in headless mode, against a local proxy that required a password on one port and accepted a whitelisted client on another.


## What a browser test gets from the address

- **No password in the browser:** The whitelist admits your runner's IPv4 address, so no secret sits in options or logs
- **Both browser schemes:** http:// for ordinary pages, socks5:// once the order is switched
- **Same origin each run:** Yesterday's run and today's leave from one IP, held for the whole billing period
- **Parallel drivers:** Several drivers may share the address, or each driver may get its own

## What goes wrong with Selenium and proxies

### Credentials inside --proxy-server

Chrome drops the username and password from that argument without an error, connects without them and gets a 407 from the proxy. The page then fails to load, which looks like a network problem rather than an authentication one.

### The driver download goes through the proxy

When Firefox options carry a proxy, Selenium Manager fetches the driver through that same proxy. With a password-only proxy that download fails before the browser starts; with the whitelist it succeeds.

### The whitelist holds the wrong address

A CI runner often leaves from a different public IP than your laptop, and some change between runs. Whitelist the address the tests run from, and update it when that changes, since each call replaces the list.

### SOCKS5 in the browser before the switch

An address set to HTTP does not answer SOCKS5. Switch the proxy on your order first and use the port it then shows; changing the scheme in the argument alone gives a browser that cannot connect.


## Questions about proxies in Selenium

### How do I use a proxy with authentication in Selenium?

In Firefox, enable WebDriver BiDi and register a handler with driver.network.add_authentication_handler that provides the username and password; that worked with Selenium 4.51. In Chrome nothing that sends credentials worked in our test: it ignores them in the proxy switch, and both BiDi handlers timed out. For Chrome, whitelist the public IP your tests run from, and the browser connects with no credentials at all.

### How do I set up a proxy in Python Selenium for Chrome?

Create ChromeOptions, add the argument --proxy-server=http://HOST:PORT, and pass the options to webdriver.Chrome. For SOCKS5, switch the proxy to SOCKS5 on your order and use socks5://HOST:PORT with the port the order then shows.

### Does the IP whitelist work with SOCKS5?

Yes. A whitelisted address is accepted without credentials over HTTP and over SOCKS5, which is what makes SOCKS5 usable from Chrome, since Chrome cannot send a SOCKS5 username and password. The whitelist is set through the API or the MCP server and takes IPv4 addresses.

### Can each browser in a test suite use a different proxy?

Yes, one per driver: the proxy is part of the options a driver starts with, so two drivers can use two addresses. Changing the proxy of a running Chrome is not possible; start a new driver instead.

### Will a long suite switch addresses halfway through?

It will not. The driver keeps the address it started with until it quits, and the address itself stays assigned to you for the whole billing period. Suites that need many origins at once would need a pool that changes them, and that is not on sale yet.

### What can I use the proxy for?

End-to-end tests of your own product, regional checks of your storefront, ad verification, price research and brand protection all run without prior review under our acceptable use policy. Driving a browser to defeat CAPTCHAs, bot defences, rate limits or account bans is a different matter: the address does not do it, and the policy prohibits attempting it.


A static address keeps browser tests repeatable: the same suite, run next week, arrives from the same place, so a change in the result comes from the site. Order an address on [ISP proxies](/isp-proxies/), see [pricing](/pricing/), and set the same address in plain HTTP calls with the [Python requests](/integrations/python-requests/) guide.



## Sources

- [Selenium documentation, Proxy](https://www.selenium.dev/documentation/webdriver/drivers/options/#proxy): setting a proxy on browser options
- [Selenium documentation, Selenium Manager](https://www.selenium.dev/documentation/selenium_manager/): how drivers are downloaded, and that the configured proxy is used for it
- [Chromium, network settings](https://www.chromium.org/developers/design-documents/network-settings/): the `--proxy-server` switch and its schemes




Selenium does not route traffic itself: it starts a browser and hands it the proxy as part of the browser's options. That is why the answer differs between Chrome and Firefox, and why proxy authentication is where most setups fail.

## Python Selenium proxy for Chrome and Firefox

Chrome reads the proxy from a command-line switch, Firefox from a proxy object on its options. Both accept a whitelisted proxy with no further setup; Firefox can also answer the proxy's password prompt through WebDriver BiDi, which Chrome did not do in our test.

