Browser automation
Use the proxy with Selenium (Python)
Chrome doesn't accept a username and password in the proxy address. With recent Selenium 4 releases authentication is handled through WebDriver BiDi, with no extensions or third-party libraries.
Step by step
- 1
Update Selenium to the latest version: pip install -U selenium.
- 2
Set the proxy protocol to HTTP in the client area.
- 3
Add --proxy-server=http://HOST:PORT to the Chrome options and enable BiDi with options.enable_bidi = True.
- 4
Register the username and password with driver.network.add_auth_handler() before opening pages.
- 5
For a new IP, call the rotation link and wait about 20 seconds before the next request.
Python
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_argument("--proxy-server=http://HOST:PORT")
options.enable_bidi = True
driver = webdriver.Chrome(options=options)
driver.network.add_auth_handler("USER", "PASSWORD")
driver.get("https://api.ipify.org")
print(driver.find_element("tag name", "body").text)
driver.quit()Replace USER, PASSWORD, HOST and PORT with your proxy's data (client area › proxy › Connection).
Tips
- If you're stuck on an old Selenium version, switch to Playwright or Puppeteer, which handle credentials natively.
- With Firefox the options are the same: webdriver.FirefoxOptions() with enable_bidi = True.
- Set the browser's language and timezone to match the proxy's country.
