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 supports unauthenticated proxies via --proxy-server. For authenticated proxies, you need selenium-wire or a Chrome extension that injects credentials.
For per-page rotation: close driver, create new one with -session-{newId}. Or use selenium-wire to modify proxy credentials between navigations.
Yes. Add options.add_argument("--headless=new") alongside the proxy configuration. All proxy features work identically in headless mode.
Yes. Use webdriver.Firefox() with selenium-wire. Firefox supports proxy auth natively via the profile, without needing extensions.
Free trial on rotating residential -- 5 minutes setup, no credit card.