python selenium代理解決方案
阿新 • • 發佈:2019-01-30
profile = webdriver.FirefoxProfile() profile.set_preference("network.proxy.type", 1) #profile.set_preference("network.proxy.share_proxy_settings", True) #profile.set_preference("network.http.use-cache", False) profile.set_preference("network.proxy.http", agent_IP) profile.set_preference("network.proxy.http_port", int(agent_Port)) profile.set_preference('network.proxy.ssl_port', int(agent_Port)) profile.set_preference('network.proxy.ssl', agent_IP) #profile.set_preference('network.proxy.socks', agent_IP) #profile.set_preference('network.proxy.socks_port', int(agent_Port)) profile.update_preferences() driver = webdriver.Firefox(firefox_profile=profile) driver.get(url)