Когда я пользуюсь прокси без username и password, все работает отлично
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()
Однако когда я пытаюсь авторизоваться через username и password
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.
Так же менял network.proxy.socksUsername на network.proxy.socks_username, - password аналогично. Но ошибка одинаковая
Кто знает как решить ? Или есть другой способ авторизации ?