带有代理的Firefox配置文件不起作用selenium webdriver python

时间:2019-05-09 05:04:31

标签: python selenium firefox webdriver

此代码未更改代理。是否有任何更改或更好的方式?

from selenium import webdriver

_drivPath = r"C:\Users\abc\Desktop\geckodriver.exe"

profile = webdriver.FirefoxProfile()
profile.set_preference("network.proxy.type", 1)
profile.set_preference("network.proxy.http", "96.42.212.235")
profile.set_preference("network.proxy.http_port", 8080)
profile.update_preferences()

_driver = webdriver.Firefox(executable_path=_drivPath, 
firefox_profile=profile)
_driver.get("https://whatismyipaddress.com")

0 个答案:

没有答案