2

There are lots of this exact same question ,but all of the answers are outdated,for example:

This is an outdated answer from 2016: Selenium using Python: enter/provide http proxy password for firefox and another outdated answer from 2017: Selenium using Python: enter/provide http proxy password for firefox

Anyways, when I'm trying to use a proxy which required a username+password like so:

from selenium import webdriver
profile = webdriver.FirefoxProfile()
profile.set_preference("network.proxy.type", 1)
profile.set_preference("network.proxy.http", PROXY_HOST)
profile.set_preference("network.proxy.http_port", PROXY_PORT)
profile.set_preference("network.proxy.socks_username", USERNAME)
profile.set_preference("network.proxy.socks_password", PASSWORD)
profile.set_preference('network.proxy.ssl', PROXY_HOST)
profile.set_preference('network.proxy.ssl_port', PROXY_PORT)

profile.update_preferences()

# executable_path  = define the path if u don't already have in the PATH system variable. 

driver = webdriver.Firefox(firefox_profile=profile)
page = driver.get('http://whatismyipaddress.com/')

It doesn't work at all.

What's the cleanest way which is actually working to connect through a proxy (given a username and a password as well) right now?

(Bonus points if you can explain why my code doesnt work-the fact it doesnt work makes no sense to me!)

yoni keren
  • 300
  • 2
  • 14

0 Answers0