Skip to content

[🐛 Bug]: Python Proxy configuration with Proxy network #10605

@lukehamil55

Description

@lukehamil55

What happened?

proxy
I am using a proxy network and want to configure it with Selenium on Python. I have seen many resources use the HOST:PORT method of configuration, but proxy networks uses the "URL method" of http://USER:PASSWORD@PROXY:PORT.

See different types of configurations below:

How can we reproduce the issue?

###Selenium_Options###
from selenium import webdriver

options = webdriver.ChromeOptions()
options.add_argument("--proxy-server=http://USER:PASSWORD@PROXY:PORT")
driver = webdriver.Chrome(options=options)
driver.get("https://some_url.com")



###Desired_Capabilities###
from selenium import webdriver
from selenium.webdriver.common.proxy import *

proxy_url = "http://USER:PASSWORD@PROXY:PORT"
proxy = Proxy({
    'proxyType': ProxyType.MANUAL,
    'httpProxy': proxy_url,
    'sslProxy': proxy_url,
    'noProxy': ''})

capabilities = webdriver.DesiredCapabilities.CHROME
proxy.add_to_capabilities(capabilities)

driver = webdriver.Chrome(desired_capabilities=capabilities)
driver.get("https://some_url.com")

Relevant log output

Log does not throw any errors with the above configurations, all the errors on on a browser side:

Reference above attached image for Selenium_Options error.

Desired Capabilities does not throw any browser errors, but the configuration still fails to add proxy.

*Proxy "URL" is in a working state and has been tested using the requests library.

FOR MORE INFORMATION: https://stackoverflow.com/questions/70806778/python-selenium-proxy-network

Operating System

Windows 10

Selenium version

Tried with: 3.141.0 and 4.0.0a7

What are the browser(s) and version(s) where you see this issue?

Version 101.0.4951.41

What are the browser driver(s) and version(s) where you see this issue?

ChromeDriver 101.0.4951.41

Are you using Selenium Grid?

NA

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-pyPython BindingsG-chromedriverRequires fixes in ChromeDriverI-defectSomething is not working as intendedJ-awaiting answerQuestion asked of user; a reply moves it to triage again

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions