Skip to content

[🐛 Bug]: Cannot run selenium webdriver.Remote with socks5 proxy enabled. #10091

@JeremieDoctrine

Description

@JeremieDoctrine

What happened?

After upgrading selenium to version 4 on our python repository, our socks5 proxy stopped working with selenium.Remote

I believe its linked to this PR : https://github.com/SeleniumHQ/selenium/pull/8297/files

How can we reproduce the issue?

Create a file named test.py

from selenium import webdriver

browser = webdriver.Remote("http://127.0.0.1:4444/wd/hub")

Run the following command HTTP_PROXY=socks5://127.0.0.1:2424 HTTPS_PROXY=socks5://127.0.0.1:2424 python test.py

Relevant log output

Traceback (most recent call last):
  File "test.py", line 4, in <module>
    browser = webdriver.Remote("http://127.0.0.1:4444/wd/hub")
  File "venv/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 256, in __init__
    self.command_executor = get_remote_connection(capabilities, command_executor=command_executor,
  File "venv/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 131, in get_remote_connection
    return handler(command_executor, keep_alive=keep_alive, ignore_proxy=ignore_local_proxy)
  File ".venv/lib/python3.9/site-packages/selenium/webdriver/remote/remote_connection.py", line 172, in __init__
    self._conn = self._get_connection_manager()
  File ".venv/lib/python3.9/site-packages/selenium/webdriver/remote/remote_connection.py", line 140, in _get_connection_manager
    urllib3.ProxyManager(self._proxy_url, **pool_manager_init_args)
  File ".venv/lib/python3.9/site-packages/urllib3/poolmanager.py", line 480, in __init__
    raise ProxySchemeUnknown(proxy.scheme)
urllib3.exceptions.ProxySchemeUnknown: Proxy URL had unsupported scheme socks5, should use http:// or https://

Operating System

Debian

Selenium version

Python 4.1.0

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

Remote chrome

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

Remote Chrome

Are you using Selenium Grid?

No response

Metadata

Metadata

Labels

C-pyPython BindingsI-defectSomething is not working as intended

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions