Setup and ConfigurationAutomation Frameworks

Selenium

Proxies for Selenium let the browser connect through a different IP address instead of always using the IP of the machine running it. This is useful for location-based tasks, testing, monitoring, and other jobs where the connection source matters.

Selenium still controls the browser and its requests. The proxy handles where the connection comes from.

What happens without one: IP bans, rate limits, geo walls

Without a proxy, websites keep seeing the same IP. As activity increases, that IP may hit a rate limit or get blocked.

Location can matter too. A page opened from Germany may not return the same content as one opened from the US.

A proxy for Selenium makes it possible to connect from different IPs and locations when needed.

Which proxy type to use with Selenium

The right proxy type depends on the job.

Proxy typeScrapingAccount managementTestingMonitoring
ResidentialGood when location and IP source matterUseful when accounts need residential IPsGood for location-based testingUseful for checking content from different locations
ISPGood when a stable IP is neededUseful for longer sessions on one IPGood for testing with a consistent IPUseful for ongoing checks from the same IP
DatacenterGood for speed and larger request volumesBetter when residential IPs are not requiredGood for general testingGood for frequent automated checks

Residential proxies are useful when the IP source and location matter. ISP proxies work well when the same IP needs to stay active for longer. Datacenter proxies make sense when the main focus is speed and scale.

The best option also depends on whether the task needs geo-targeting, a stable connection, or access to a larger pool of IPs.

How to connect a proxy in Selenium

The Selenium proxy setup needs the Geonode host, port, username, and password. Keep the credentials in environment variables, then load them when setting up the proxy in code.

For authenticated Geonode proxies, our test used selenium-wire because ChromeDriver's --proxy-server option alone did not handle the authentication reliably.

Using Geonode? Get the username and password from Access Credentials and the host, port, and protocol from Proxy Server Information.

Settings path or code

First, import Selenium Wire and configure the browser:

from seleniumwire import webdriver
from selenium.webdriver.chrome.options import Options
import os
from dotenv import load_dotenv

load_dotenv()

options = Options()
options.add_argument("--headless=new")

Then add the proxy configuration when creating the driver:

host = os.environ["GEONODE_PROXY_HOST"]
port = os.environ["GEONODE_PROXY_PORT"]
user = os.environ["GEONODE_PROXY_USER"]
password = os.environ["GEONODE_PROXY_PASS"]

driver = webdriver.Chrome(
    options=options,
    seleniumwire_options={
        "proxy": {
            "http": f"http://{user}:{password}@{host}:{port}",
            "https": f"http://{user}:{password}@{host}:{port}",
            "no_proxy": "localhost,127.0.0.1",
        }
    },
)

This configuration was tested successfully with Selenium Wire and an authenticated Geonode proxy.

Authentication format host:port:user:pass

Geonode gives you four values:

proxy.geonode.io:PORT:USERNAME:PASSWORD

Store them in environment variables:

GEONODE_PROXY_HOST=proxy.geonode.io
GEONODE_PROXY_PORT=9000
GEONODE_PROXY_USER=YOUR_USERNAME
GEONODE_PROXY_PASS=YOUR_PASSWORD

Then load the values and build the authenticated proxy URL:

host = os.environ["GEONODE_PROXY_HOST"]
port = os.environ["GEONODE_PROXY_PORT"]
user = os.environ["GEONODE_PROXY_USER"]
password = os.environ["GEONODE_PROXY_PASS"]

proxy_url = f"http://{user}:{password}@{host}:{port}"

Pass it through Selenium Wire:

seleniumwire_options = {
    "proxy": {
        "http": proxy_url,
        "https": proxy_url,
    }
}

To check the setup, make a request to an IP-check endpoint:

driver.get("http://ip-api.com/json")
print(driver.find_element("tag name", "body").text)

Our basic test returned a proxy IP in Ajman, United Arab Emirates, confirming that Selenium was using the proxy connection.

Rotation vs sticky session in Selenium

If the requests do not need to keep the same IP, use rotation.

Configure Selenium Wire with the Geonode rotating proxy on port 9000:

proxy_url = f"http://{user}:{password}@proxy.geonode.io:9000"

seleniumwire_options = {
    "proxy": {
        "http": proxy_url,
        "https": proxy_url,
    }
}

We created a fresh driver for each request and recorded the returned IPs:

TestIP
Request 190.249.43.7
Request 2189.151.96.78
Request 362.118.97.110
Request 4118.99.64.5
Request 5188.125.171.106

All five requests returned different IPs in this test, giving us five unique IPs.

If related requests need to stay on the same IP, use a sticky session instead:

sticky_user = f"{user}-session-blogselenium01-lifetime-10"

proxy_url = f"http://{sticky_user}:{password}@proxy.geonode.io:10000"

The same session returned 213.59.151.245 for all three requests, confirming that the sticky session kept the same IP during the test.

See the Geonode guides for rotating proxies and sticky sessions for the available settings.

Common proxy errors in Selenium and how to fix them

If the proxy is not working, start with the connection details. Check the username and password, then the host, port, and protocol. The result returned by Selenium or Selenium Wire can usually help narrow down the problem.

407 Proxy Authentication Required

A 407 usually points to an authentication problem.

In our Selenium Wire test, incorrect credentials did not return a visible 407 page. Instead, navigation returned an empty document with no IP result. Using the correct Geonode credentials fixed the connection.

Make sure the username and password are included in the Selenium Wire proxy URL:

proxy_url = f"http://{user}:{password}@proxy.geonode.io:9000"

ERR_TUNNEL_CONNECTION_FAILED / connection refused

A connection error usually means Selenium could not reach the proxy.

When we tested an unreachable proxy port, Selenium Wire returned a 502 Bad Gateway page containing:

ProtocolException:
Server connection to ('proxy.geonode.io', 1) failed

[WinError 10061]
No connection could be made because the target machine actively refused it

A Chromium ERR_PROXY_CONNECTION_FAILED error was not returned in this test because Selenium Wire intercepted the connection first.

Check the proxy host and port and make sure the correct Geonode endpoint is being used.

Timeouts and empty responses

A timeout means the page did not load within the configured time.

Set a page-load timeout in Selenium:

driver.set_page_load_timeout(5)

When we tested a non-routable proxy, Selenium returned:

TimeoutException:
timeout: Timed out receiving message from renderer

Setting an explicit page-load timeout makes a stalled proxy connection fail instead of waiting indefinitely.

ERR_NO_SUPPORTED_PROXIES

Using Chrome's --proxy-server option alone caused problems with authenticated Geonode proxies in our test.

This configuration did not successfully authenticate:

--proxy-server=http://proxy.geonode.io:9000

Putting the username and password directly into the same Chrome argument also failed:

--proxy-server=http://USER:PASS@proxy.geonode.io:9000

Chrome returned:

ERR_NO_SUPPORTED_PROXIES

The working setup was to use Selenium Wire and pass the authenticated proxy through seleniumwire_options["proxy"]. After changing the configuration, the proxy test succeeded.

Selenium + Geonode: what you get

Selenium handles browser automation and page requests. Geonode handles the proxy connection.

You can choose residential, ISP, or datacenter proxies based on the job, then use rotation, sticky sessions, and geo-targeting where needed. This keeps the proxy configuration separate from the rest of the browser automation code.

Plans vary by proxy type, with some options priced per GB.

FAQ

If you encounter any issues, refer to the troubleshooting section or Geonode support.

Was this page helpful?

On this page