# Configure TrueProxies with Selenium

> Configure TrueProxies with Selenium WebDriver in Python, including Chrome trusted IP setup, Firefox proxy settings and Residential IPv4 country targeting.

Source: https://docs.trueproxies.com/integrations/selenium/

> **Use your own endpoints**
>
> The examples below use placeholders. Copy the connection host, ports, username, and proxy password from the **Username and password** tab of your service in the dashboard. See [How to connect](https://docs.trueproxies.com/proxy-instructions/how-to-connect/#connection-host-and-ports).

## Python + Chrome with a trusted IP

```python
from selenium import webdriver
from selenium.webdriver.chrome.options import Options

PROXY = "YOUR_HOST:YOUR_HTTP_PORT"

chrome_options = Options()
chrome_options.add_argument(f"--proxy-server=http://{PROXY}")

driver = webdriver.Chrome(options=chrome_options)
driver.get("https://httpbin.org/ip")
print(driver.page_source)
driver.quit()
```

> **Note**
>
> This Chrome example assumes the machine’s public egress IP is already a trusted IP on your service. Chrome extension authentication recipes based on Manifest V2 are obsolete; use a [trusted IP](https://docs.trueproxies.com/proxy-instructions/trusted-ips/) or a maintained client that supports proxy credentials directly.

## Python + Firefox

```python
from selenium import webdriver
from selenium.webdriver.firefox.options import Options

PROXY_HOST = "YOUR_HOST"
PROXY_PORT = 8080

options = Options()
options.set_preference("network.proxy.type", 1)
options.set_preference("network.proxy.http", PROXY_HOST)
options.set_preference("network.proxy.http_port", PROXY_PORT)
options.set_preference("network.proxy.ssl", PROXY_HOST)
options.set_preference("network.proxy.ssl_port", PROXY_PORT)

driver = webdriver.Firefox(options=options)
driver.get("https://httpbin.org/ip")
print(driver.page_source)
driver.quit()
```

## Residential IPv4 country targeting

Use the username parameter:

```python
PROXY_USER = "your_username-country-us"
```

## Related guides

- [Connection and username format](https://docs.trueproxies.com/proxy-instructions/how-to-connect/)
- [HTTP CONNECT and SOCKS5](https://docs.trueproxies.com/proxy-instructions/proxy-protocols/)
- [Trusted IPs](https://docs.trueproxies.com/proxy-instructions/trusted-ips/)
- [Troubleshooting checklist](https://docs.trueproxies.com/support/)
