Selenium with ProxyPanel

Selenium with ProxyPanel

Selenium is a browser automation framework. Here's how to route Selenium traffic through ProxyPanel.

Installation

pip install selenium webdriver-manager

Chrome with HTTP Proxy

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

PROXY = "proxy-host:http-port"

chrome_options = Options()
chrome_options.add_argument(f"--proxy-server={PROXY}")

driver = webdriver.Chrome(options=chrome_options)
driver.get("https://httpbin.org/ip")
print(driver.page_source)
driver.quit()

With Authentication

For authenticated proxies, use a Chrome extension or use selenium-wire:

pip install selenium-wire
from seleniumwire import webdriver

options = {
    "proxy": {
        "http": "socks5://api-key:api-key@proxy-host:socks5-port",
        "https": "socks5://api-key:api-key@proxy-host:socks5-port",
    }
}

driver = webdriver.Chrome(seleniumwire_options=options)
driver.get("https://httpbin.org/ip")
print(driver.page_source)
driver.quit()
Selenium with ProxyPanel - ProxyPanel Help