Selenium proxy integration

Selenium drives a real browser, so the proxy is set at browser launch through the driver options rather than per request. Chrome takes the proxy on a --proxy-server argument but will not read credentials from it, so the reliable pattern is a small Manifest V3 extension that answers the proxy's login prompt with your Murphy username and password. The snippet below wires both together.

browser.pypython
import json
import zipfile
from selenium import webdriver

# Residential gateway and your dashboard credentials. For an ISP proxy, use
# the IP, port, user and pass of one line from your list instead.
HOST, PORT = "gw-eu.murphyproxies.com", 8888
USER, PASS = "USERNAME", "PASSWORD"

# Chrome ignores credentials on --proxy-server, so a tiny Manifest V3
# extension answers the proxy's auth challenge instead.
manifest = {
    "name": "murphy-proxy-auth",
    "version": "1.0",
    "manifest_version": 3,
    "permissions": ["webRequest", "webRequestAuthProvider"],
    "host_permissions": ["<all_urls>"],
    "background": {"service_worker": "bg.js"},
}
background = f"""
chrome.webRequest.onAuthRequired.addListener(
  (details, done) => done(details.isProxy
    ? {{authCredentials: {{username: {json.dumps(USER)}, password: {json.dumps(PASS)}}}}}
    : {{}}),
  {{urls: ["<all_urls>"]}},
  ["asyncBlocking"]
);
"""
with zipfile.ZipFile("murphy_proxy.zip", "w") as z:
    z.writestr("manifest.json", json.dumps(manifest))
    z.writestr("bg.js", background)

options = webdriver.ChromeOptions()
options.add_argument(f"--proxy-server=http://{HOST}:{PORT}")
options.add_extension("murphy_proxy.zip")
# Google Chrome 137+ no longer loads extensions this way: point Selenium at
# Chrome for Testing or Chromium, e.g. options.binary_location = "/path/to/chrome"
driver = webdriver.Chrome(options=options)
driver.get("https://httpbin.org/ip")
print(driver.find_element("tag name", "body").text)
driver.quit()

Setup in 5 steps

  1. 1Install the client with pip install selenium. Selenium Manager fetches a matching chromedriver for you.
  2. 2Copy your Murphy host, port, username and password from the dashboard into the top of the script.
  3. 3Build the small Manifest V3 extension so Chrome answers the proxy authentication prompt automatically.
  4. 4Pass --proxy-server, load the extension with options.add_extension() and launch the driver, on Chrome for Testing or Chromium if your Google Chrome is version 137 or later.
  5. 5Open an IP echo page and read the body to confirm the browser exits through the proxy.

Selenium proxy questions

How to route Selenium through Murphy, authentication and rotation included.

Get credentials for Selenium

Pick the network that fits your target. ISP proxies for fast, stable sessions, residential proxies for broad IP diversity against strict anti-bot systems.