SOCKS5 Authentication With Undetected Chromedriver (Selenium)

The Oracle

Regular Member
Joined
Jan 13, 2007
Messages
210
Reaction score
148
I can get SOCKS5 to work with

Code:
opts.add_argument(f'--proxy-server=socks5://IP:PORT')


It works fine with IP whitelisting.

However, how can I pass user and pass so that I may use it without IP whitelisting?
 
Did you tried sendkeys?

I am also using IP whitelisting. Also are you using headless browser or normal?
 
Sendkeys? It doesn't even load anything. Just says error if I try to use authentication.

Not headless.

With whitelisting it works fine. I guess my question is, how can one pass proxy login info to UC Chrome?
 
If you're using python, here's a solution - https://stackoverflow.com/posts/55582859/revisions

The function get_chromedriver will return a configured selenium webdriver to use in your code.

This does have some issues in headless mode, since headless chrome doesn't support extensions. But if you're declaring a header, this won't be an issue.

Another alternative is to use pproxy - https://github.com/qwj/python-proxy

Something like

Python:
# pproxy -r ${HTTP_PROXY}\#${PROXY_AUTH} -l http://:8080 -v
# 1.2.3.4:1234 is remote address:port, username and password is used auth for remote proxy.

 pproxy -r http://1.2.3.4:1234\#username:password  -l http://:8080 -v
 
To pass a username and password with your SOCKS5 proxy in Selenium, you can modify your code to include the credentials in the proxy URL as follows:
Python:
username = 'your_username'
password = 'your_password'
proxy = f"{username}:{password}@IP:PORT"

opts.add_argument(f'--proxy-server=socks5://{proxy}')
 
Back
Top