Selenium(Firefox)的代理支持

2024-05-12 14:40:05 发布

您现在位置:Python中文网/ 问答频道 /正文

profile.set_preference('network.proxy_type',1)
profile.set_preference('network.proxy.http',"107.172.43.125")
profile.set_preference('network.proxy.http_port',3128)
profile.update_preferences()

browser = webdriver.Firefox(firefox_profile=profile)

browser.get(
    "https://www.whatsmyip.org/")

你知道为什么这不起作用吗?它似乎加载了firefox并进入了网页,但当我在浏览器上检查我的IP时,它显示为我的家庭IP

我有最新的geckodriver和selenium。多谢各位


Tags: ipbrowserhttpporttypeupdatenetworkfirefox