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
  • 2
    Can you please edit your question? I don't know what your exact question is. Commented Nov 23, 2020 at 18:08

1 Answer 1

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)

Sign up to request clarification or add additional context in comments.

2 Comments

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
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."

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.