Skip to main content

Selenium proxy setup

Kate avatar
Written by Kate
Updated over a week ago

Selenium is a popular tool for automating your browsers with wide support of Open Source projects.

To establish a proxy connection via Selenium you would need to download a Selenium browser driver from the official website. Choose the browser from the list below and download the driver:
- Google Chrome

Connection via login/pass authorization on Google Chrome example:

Creating a Chrome extension by including two files in an archive, named


var config = { 
mode: "fixed_servers",
rules: {
singleProxy: {
scheme: "http",
host: "",
port: parseInt(9000)
bypassList: [""]
chrome.proxy.settings.set({value: config, scope: "regular"}, function() {});
function callbackFn(details) {
return {
authCredentials: {
username: "PROXY_USERNAME",
password: "PROXY_PASSWORD"

{urls: ["<all_urls>"]},


"version": "1.0.0",
"manifest_version": 3,
"name": "Chrome Proxy",
"permissions": [
"webRequestBlocking" ],
"background": {
"service_worker": "background.js"

The Chrome extension can be added to Selenium using the add_extension method:

from selenium import webdriver 
from import Options
chrome_options = Options()
driver = webdriver.Chrome(executable_path='chromedriver.exe', chrome_options=chrome_options)

In order to change the port configuration to be dynamic, please use the following command:

from selenium import webdriver from selenium.webdriver.common.proxy import Proxy, ProxyType from import WebDriverWait from import expected_conditions as EC import random # Import the 'random' module # Proxy credentials proxy_username = "YOUR PACKAGE LOGIN" proxy_password = "wifi;us;;;" # Proxy server address proxy_server = "" # Generate a random proxy port number between 9000 and 9999 new_proxy_port = random.randint(9000, 9999) # Configure proxy with the new port proxy = Proxy() proxy.proxy_type = ProxyType.MANUAL proxy.http_proxy = f"{proxy_server}:{new_proxy_port}" proxy.ssl_proxy = f"{proxy_server}:{new_proxy_port}" proxy.socks_proxy = f"{proxy_server}:{new_proxy_port}" proxy.ssl_proxy = f"{proxy_server}:{new_proxy_port}" proxy.ftp_proxy = f"{proxy_server}:{new_proxy_port}" proxy.no_proxy = "" # Authentication credentials auth_username = proxy_username auth_password = proxy_password

Connecting via IP authorization

from selenium import webdriver 
PROXY = ""
chrome_options = WebDriver.ChromeOptions()
chrome_options.add_argument('' % PROXY) chrome = webdriver.Chrome(chrome_options=chrome_options) chrome.get("")

Please feel free to reach out to support if you have any questions :)

Did this answer your question?