How to use a proxy with Selenium
Selenium sets a proxy through the browser options’ proxy capability, with a host and a port. That capability has no place for a username and password that Chrome will use, so the simplest working setup is a proxy that accepts your machine’s address without a login (IP allowlisting, which many providers offer in their dashboard). The example was run once on Oct 19, 2026, with selenium-webdriver 4.51.0 for Node.js and Chrome for Testing 156, against a test proxy that allows the machine’s address; the output address is replaced with a documentation address.
Setup guide · Last revised Oct 19, 2026
On this page
The working script (JavaScript)
const { Builder } = require("selenium-webdriver");
const chrome = require("selenium-webdriver/chrome");
const proxy = require("selenium-webdriver/proxy");
(async () => {
const options = new chrome.Options().addArguments("--headless=new");
const driver = await new Builder()
.forBrowser("chrome")
.setChromeOptions(options)
.setProxy(proxy.manual({ http: "proxy.example.com:8000", https: "proxy.example.com:8000" }))
.build();
try {
await driver.get("https://api.ipify.org");
console.log(await driver.findElement({ css: "body" }).getText());
} finally {
await driver.quit();
}
})();
203.0.113.24
The Selenium documentation shows the same capability in Java, proxy.setHttpProxy("myproxy.com:8080") and options.setCapability("proxy", proxy) (Selenium, browser options); the Python and other bindings take the same host and port.
Allow your machine’s address first
In the provider’s dashboard, add the public address of the machine that runs Selenium to the allowed list (to see it, run curl https://api.ipify.org on that machine). Until you do, the proxy answers 407 Proxy Authentication Required, and the page fails to load (Chrome reports ERR_INVALID_AUTH_CREDENTIALS, as in our Puppeteer run). A server whose address changes (a home connection, some cloud instances) has to be added again each time. How the two login methods compare: username and password vs IP whitelist.
If your provider gives only a username and password
Chrome cannot take them from the capability, and it cannot send them to a SOCKS5 proxy at all. The ways round it are a browser automation tool that passes the login to the page, such as Puppeteer’s page.authenticate, or a small proxy on your own machine that adds the login and forwards to the provider. Ask the provider first whether your plan can use IP allowlisting.
Check it before a long run
Load https://api.ipify.org once with the proxy and once without, as above: if both show the same address, the capability was not applied. Then load one page of the site your job needs and check the content, not only that it loaded: 200 OK but blocked.
Next
How to test a proxy checks location and speed with curl. What a browser’s traffic costs: a full page with its images and scripts is often many times its HTML, so price your job on a few measured pages (how much bandwidth web scraping uses).
Price it for your amount
Today's checkout totals, every billing type competing. Change the amount to recalculate.
Geonode
$34.65Residential monthly subscription · Monthly
Checked Oct 24, 2026 · $0.69 per GB used
Buy at Geonode →GB and IP packages use separate amounts and billing units.