Python | selenium 如何配置 Firefox 的 IP 代理?

2018-07-07 20:02:49 +08:00
 XiiLii
from selenium import webdriver

proxy = '117.36.103.170:8118'
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--proxy-server=http://' + proxy)
chrome = webdriver.Firefox(chrome_options=chrome_options)
chrome.get('http://httpbin.org/get')

我参照上面的 Chrome 的配置方法,修改成以下的 Firefox 配置,为何没有成功?是不是哪里错了?求解答

from selenium import webdriver

proxy = '117.36.103.170:8118'
firefox_options = webdriver.FirefoxOptions()
firefox_options.add_argument('--proxy-server=http://' + proxy)
firefox = webdriver.Firefox(firefox_options=firefox_options)
firefox.get('http://httpbin.org/get')
4825 次点击
所在节点    Python
3 条回复
omph
2018-07-07 23:03:25 +08:00
XiiLii
2018-07-08 10:16:52 +08:00
@omph 谢谢,已参照其中的方法改写成 Python 代码
XiiLii
2018-07-08 19:29:31 +08:00
Python | Firefox IP 代理 - 灵魂的文章 - 知乎
https://zhuanlan.zhihu.com/p/39281522

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/468935

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX