Proxy Selenium Python Firefox
Question: How can I redirect the traffic of Firefox launched by Selenium in Python to a
proxy? I have used the solutions suggested on the web but they doesn't work!

I have tried:

    
    
    profile = webdriver.FirefoxProfile() 
    profile.set_preference("network.proxy.type", 1)
    profile.set_preference("network.proxy.http", "54.213.66.208")
    profile.set_preference("network.proxy.http_port", 80)
    profile.update_preferences() 
    driver = webdriver.Firefox(profile)
    


Answer: You need to import the following:

    
    
    from selenium.webdriver.common.proxy import *
    

Then setup the proxies:

    
    
    myProxy = "xx.xx.xx.xx:xxxx"
    
    proxy = Proxy({
        'proxyType': ProxyType.MANUAL,
        'httpProxy': myProxy,
        'ftpProxy': myProxy,
        'sslProxy': myProxy,
        'noProxy': '' # set this value as desired
        })
    

Then call the webdriver.Firefox() function as follows:

    
    
    driver = webdriver.Firefox(proxy=proxy)
    driver.get("http://www.google.com")
    

Dont remember where exactly I found this solution, but its out there
somewhere. Will surely provide a link if I find it again. Just took this part
out from my code.

