2

I Try run code with Python Selenium

from selenium import webdriver
import time

profile = webdriver.FirefoxProfile()
profile.set_preference("network.proxy_type",1)
profile.set_preference("network.proxy.http","124.240.187.80")
profile.set_preference("network.proxy.http_port",82)
profile.update_preferences()

driver=webdriver.Firefox(firefox_profile=profile)
driver.get('https://www.whatismyip.com/')
driver.sleep(3)
driver.close()

But my IP address does not change when you run this file.

How can I change my ip address. I am developing a web crawler and need to change the ip

1 Answer 1

5

Use desired capabilities for FF.

proxy = "124.240.187.80:82"

webdriver.DesiredCapabilities.FIREFOX['proxy'] = {
   "httpProxy":proxy,
   "ftpProxy":proxy,
   "sslProxy":proxy,
   "noProxy":None,
   "proxyType":"MANUAL",
   "class":"org.openqa.selenium.Proxy",
   "autodetect":False
}

WebDriver: Advanced Usage - proxy

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

1 Comment

How can this be done for google chrome

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.