V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
XiiLii
V2EX  ›  Python

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

  •  
  •   XiiLii · 2018-07-07 20:02:49 +08:00 · 4818 次点击
    这是一个创建于 2113 天前的主题,其中的信息可能已经有所发展或是发生改变。
    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')
    
    3 条回复    2018-07-08 19:29:31 +08:00
    omph
        1
    omph  
       2018-07-07 23:03:25 +08:00
    XiiLii
        2
    XiiLii  
    OP
       2018-07-08 10:16:52 +08:00
    @omph 谢谢,已参照其中的方法改写成 Python 代码
    XiiLii
        3
    XiiLii  
    OP
       2018-07-08 19:29:31 +08:00
    Python | Firefox IP 代理 - 灵魂的文章 - 知乎
    https://zhuanlan.zhihu.com/p/39281522
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   869 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 21:52 · PVG 05:52 · LAX 14:52 · JFK 17:52
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.