Install
Selenium 4.6 and later fetch a matching driver for you.
pip install seleniumRotating residential
Save these two files in a folder called proxy-auth. The extension points Chrome at the residential gateway and supplies the credentials whenever it asks.
// manifest.json
{
"manifest_version": 3,
"name": "proxy-auth",
"version": "1.0",
"permissions": ["proxy", "webRequest", "webRequestAuthProvider"],
"host_permissions": ["<all_urls>"],
"background": { "service_worker": "background.js" }
}
// background.js
chrome.proxy.settings.set({
value: {
mode: "fixed_servers",
rules: { singleProxy: { scheme: "http", host: "resi.proxymonkey.io", port: 8000 } },
},
scope: "regular",
});
chrome.webRequest.onAuthRequired.addListener(
() => ({ authCredentials: { username: "USER", password: "PASS" } }),
{ urls: ["<all_urls>"] },
["blocking"],
);A static datacenter or ISP IP
Load the extension with Chrome options. For a static ISP or datacenter IP, change the host and port in background.js to the address your dashboard lists for that order.
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_argument("--load-extension=/path/to/proxy-auth")
driver = webdriver.Chrome(options=options)
driver.set_page_load_timeout(30)
driver.get("https://httpbin.org/ip")
print(driver.find_element("tag name", "body").text)
driver.quit()Keeping one identity
One driver is one browser profile with one set of cookies. To run two identities, start two drivers, each with its own copy of the extension pointing at its own static IP. On residential, a sticky session keeps one address across a login; the session setting for your account is in the dashboard.