Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 97799

Python: How to use the proxy socks 4/5 in selenium webdriver firefox

$
0
0

This is the code used. The error is that Firefox does not use the proxy. Is there another way to specify a proxy sock? Thank you very much for your help.

class post(object):
def firefox(self, proxy,port):

    proxy_to_use= proxy + ":" + port
    profile = webdriver.FirefoxProfile()
    profile.set_preference("network.proxy.type", 1)
    profile.set_preference("network.proxy.socks", proxy)
    profile.set_preference("network.proxy.socks_port", port)
    profile.set_preference("network.proxy.socks_version", 4)
    profile.update_preferences()

    options = webdriver.FirefoxOptions()

    browser = webdriver.Firefox(executable_path = geckodriver, firefox_options = options,firefox_profile=profile)
    browser.get("https://ipinfo.io")
    browser.quit()

Viewing all articles
Browse latest Browse all 97799

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>