I'm trying to use SOCKS5 proxy provided by PIA (https://www.privateinternetaccess.com). I generated user/pass for SOCKS5 on their site, but I can't use this information, since I don't know where to put it. I tried using ChromeOptions
, but it's not working.
def create_browser(self, proxy):
"""
proxy = "xGeneratedUser:[email protected]:1080"
"""
chrome_options = webdriver.ChromeOptions()
if proxy:
chrome_options.add_argument("--proxy-server=socks5://" + proxy)
try:
self.browser = webdriver.Chrome('./chromedriver', chrome_options=chrome_options)
self.browser.set_window_size(800, 600)
except Exception as error:
return False
In case anyone stumbles on this...
I was trying to connect with a socks5 proxy with selenium and believe the issue was that the proxy requires user/pass auth, and since I was using the chromedriver it did not work because chrome does not natively support this.
Try connecting with a socks5 proxy that does not require auth or finding a driver that supports this - not aware of which/what this might be though.
I am stumping in here too. I also want to use auth proxy in the chrome webdriver of selenium. I have tried use httpProxy or PAC, in which we cannot use username and password.
And then I saw the socksUsername
and socksPassword
but it is still useless.
Because the error:
selenium.common.exceptions.InvalidArgumentException: Message: invalid argument: cannot parse capability: proxy
from invalid argument: Specifying 'socksProxy' requires an integer for 'socksVersion'
(Driver info: chromedriver=73.0.3683.20 (8e2b610813e167eee3619ac4ce6e42e3ec622017),platform=Mac OS X 10.14.3 x86_64)
I found chrome code said need the socksProxy
key, but the current selenium is not support socksProxy, see selenium code.
So I have to choose other way:
export http_proxy=http://username@pass:host:port
UPDATE: Finally, I use pproxy make as a proxy redirector on local.
# 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
So now your can connect to your localhost:8080 without auth.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With