Browser automation framework for Python. Configure Chrome or Firefox to route all traffic through KnoxProxy for authenticated browsing sessions.
Install from PyPI.
pip install seleniumAdd proxy via Chrome options.
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = Options()
options.add_argument("--proxy-server=http://gw.knoxproxy.com:7000")
driver = webdriver.Chrome(options=options)Use a Chrome extension for auth or username-in-URL.
# Use seleniumwire for authenticated proxies
# pip install selenium-wire
from seleniumwire import webdriver
options = {
'proxy': {
'http': 'http://USER:PASS@gw.knoxproxy.com:7000',
'https': 'http://USER:PASS@gw.knoxproxy.com:7000',
}
}
driver = webdriver.Chrome(seleniumwire_options=options)Browse through the proxy.
driver.get("https://httpbin.org/ip")
print(driver.page_source)
driver.quit()Country in username.
'http': 'http://USER-country-de:PASS@gw.knoxproxy.com:7000'Verify exit IP via httpbin.
driver.get("https://httpbin.org/ip")"""KnoxProxy + Selenium -- authenticated proxy with selenium-wire."""
from seleniumwire import webdriver
PROXY_OPTIONS = {
"proxy": {
"http": "http://USER:PASS@gw.knoxproxy.com:7000",
"https": "http://USER:PASS@gw.knoxproxy.com:7000",
}
}
driver = webdriver.Chrome(seleniumwire_options=PROXY_OPTIONS)
try:
driver.get("https://httpbin.org/ip")
print(driver.find_element("tag name", "pre").text)
finally:
driver.quit()Each new page load uses the same proxy connection. For IP rotation between pages, close and re-create the driver with a new session ID in the proxy username.
| Problem | Fix |
|---|---|
| ERR_PROXY_CONNECTION_FAILED | Verify host and port. Ensure no conflicting proxy extensions. |
| ERR_TUNNEL_CONNECTION_FAILED | Use selenium-wire for authenticated proxies. Check credentials. |
| WebDriverException: chrome not reachable | Update ChromeDriver to match your Chrome version. Use webdriver-manager for auto-management. |
USER-country-de-city-berlin-session-profile07Order matters -- geo flags before the session flag. The session name is free text; use the profile ID so the mapping is self-documenting. Password stays as issued; no flags belong there. HTTP on :7000, SOCKS5 on :7001, same credentials.
Vanilla Selenium works with unauthenticated proxies through the --proxy-server Chrome option, but plain Selenium has no way to supply a username and password for a proxy like KnoxProxy. For authenticated proxy access, install selenium-wire, or build a small Chrome extension that injects the credentials automatically when the browser hits the proxy authentication prompt.
Selenium keeps one proxy connection for the whole browser session, so getting a new IP mid-crawl means closing the driver and launching a fresh one with a new -session-{newId} suffix in the username. Alternatively, use selenium-wire, which lets you modify the proxy credentials on the fly between page navigations without restarting the browser at all.
Yes, KnoxProxy works identically with headless Chrome. Add options.add_argument("--headless=new") alongside your existing proxy configuration in Selenium, and every proxy feature, including authentication, geo-targeting, and IP rotation, behaves the same way it would in a visible browser window, with no changes needed to your proxy setup code.
Yes, use webdriver.Firefox() with selenium-wire the same way you would with Chrome. Firefox actually has an advantage here: it supports proxy authentication natively through its profile settings, so in some setups you can skip selenium-wire and Chrome-style extension workarounds entirely and authenticate to KnoxProxy directly in the Firefox profile configuration.
Rotating residential proxies -- 5 minutes setup, instant activation, 14-day money-back guarantee.