0
myProxy = '176.9.119.170:8080'
ip, port = myProxy.split(":")
fp = webdriver.FirefoxProfile()
fp.set_preference('network.proxy.type', 1)
fp.set_preference('network.proxy.http', ip)
fp.set_preference('network.proxy.http_port', int(port))
driver = webdriver.Firefox(fp)
driver.get('https://whatismyipaddress.com/')

And i see my ip. How to make this proxy work?

1 Answers1

0

I need a bit more information on what the error is but I think if you just want to make it work:

From latest documentation:

from selenium import webdriver

PROXY = "<HOST:PORT>"
webdriver.DesiredCapabilities.FIREFOX['proxy'] = {
    "httpProxy": PROXY,
    "ftpProxy": PROXY,
    "sslProxy": PROXY,
    "proxyType": "MANUAL",

}

with webdriver.Firefox() as driver:
    # Open URL
    driver.get("https://selenium.dev")

If you want to maintain your code, I tested your code locally and found that you might consider specifying the profile with webdriver.Firefox(firefox_profile=fp)

Pat Moss
  • 21
  • 3
  • selenium.common.exceptions.WebDriverException: Message: Reached error page: about:neterror?e=dnsNotFound&u=https%3A//selenium.dev/&c=UTF-8&d=We%20can%E2%80%99t%20connect%20to%20the%20server%20at%20selenium.dev. This error occurs after running the above code using working proxies – goldkreateav Nov 24 '20 at 07:57
  • I also tried to make selenium work with different answers from this site, but it gives an infinite redirect, then it doesn't change the ip. "The page isn’t redirecting properly Firefox has detected that the server is redirecting the request for this address in a way that will never complete." – goldkreateav Nov 24 '20 at 08:04