PacketStream integration

Using PacketStream residential proxies with Selenium

Launch an interactive Selenium Chrome session through PacketStream, authenticate at the proxy prompt, and check the residential exit.

Use this setup when an existing Selenium workflow needs a residential exit and you can answer Chrome’s proxy credential prompt. For an unattended run, use Playwright so the browser receives proxy credentials at launch.

Configure

Install Selenium for Python:

python -m pip install selenium

Launch Chrome with PacketStream’s HTTPS endpoint:

from selenium import webdriver

options = webdriver.ChromeOptions()
options.add_argument("--proxy-server=https://proxy.packetstream.io:31111")
driver = webdriver.Chrome(options=options)

try:
    driver.get("https://ipinfo.io")
    print(driver.find_element("tag name", "body").text)
finally:
    driver.quit()

The first navigation pauses at Chrome’s proxy credential prompt. Enter your PacketStream username as the username and your dashboard auth key as the password. Selenium cannot fill this browser-level prompt, so keep Chrome visible and complete it manually.

Chrome does not provide authenticated SOCKS5 proxy support for this configuration, so use PacketStream’s HTTPS endpoint.

Verify your exit

Run the script, complete the proxy prompt, and inspect the body returned by ipinfo.io for the observed ip and country.

Country targeting and sticky sessions

Keep the username unchanged. In Chrome’s proxy credential prompt, enter the modified password:

AUTH_KEY_country-US_session-webdriver42

The Selenium options and proxy endpoint stay the same.

Troubleshooting

  • Keep Chrome visible. The first driver.get waits while you complete the browser’s proxy credential prompt.
  • Do not give PacketStream credentials to Selenium’s general authentication handler. It can answer destination authentication challenges as well as proxy challenges.
  • WebDriver sessions reuse browser connections. A second navigation does not guarantee a new exit.

See proxy troubleshooting for authentication, browser timeouts, TLS, and connection behavior.

Ready to run Selenium through PacketStream? Create an account to get the proxy username and auth key used in the example above.
Create account