Answer the question
In order to leave comments, you need to log in
How to install socks5 proxy with authorization in Firefox in selenium?
When I use proxy without username and password everything works fine
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.proxy import *
profile = webdriver.FirefoxProfile()
profile.set_preference("network.proxy.type", 1)
profile.set_preference("network.proxy.socks", "ip")
profile.set_preference("network.proxy.socks_port", port)
profile.set_preference("network.proxy.socks_version", 5)
profile.update_preferences()
driver = webdriver.Firefox(firefox_profile=profile)
driver.get("http://api64.ipify.org")
print(driver.page_source)
driver.close()
driver.quit()
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.proxy import *
profile = webdriver.FirefoxProfile()
profile.set_preference("network.proxy.type", 1)
profile.set_preference("network.proxy.socks", "ip")
profile.set_preference("network.proxy.socks_port", port)
profile.set_preference("network.proxy.socksUsername", "username")
profile.set_preference("network.proxy.socksPassword", "password")
profile.set_preference("network.proxy.socks_version", 5)
profile.update_preferences()
driver = webdriver.Firefox(firefox_profile=profile)
driver.get("http://api64.ipify.org")
print(driver.page_source)
driver.close()
driver.quit()
Traceback (most recent call last):
File "step_one.py", line 22, in <module>
driver.get("http://api64.ipify.org")
File "/usr/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 333, in get
self.execute(Command.GET, {'url': url})
File "/usr/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/usr/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Reached error page: about:neterror?e=connectionFailure&u=http%3A//api64.ipify.org/&c=UTF-8&d=Firefox%20can%E2%80%99t%20establish%20a%20connection%20to%20the%20server%20at%20api64.ipify.org.
Answer the question
In order to leave comments, you need to log in
Firefox should not care where the socks proxy server will authorize users.
Try FoxyProxy extension to connect to socks5 proxy with login and password.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question