推荐学习书目
› 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 · Jul 7, 2018 · 5533 views
    This topic created in 3004 days ago, the information mentioned may be changed or developed.
    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 replies  •  2018-07-08 19:29:31 +08:00
    omph
        1
    omph  
       Jul 7, 2018
    XiiLii
        2
    XiiLii  
    OP
       Jul 8, 2018
    @omph 谢谢,已参照其中的方法改写成 Python 代码
    XiiLii
        3
    XiiLii  
    OP
       Jul 8, 2018
    Python | Firefox IP 代理 - 灵魂的文章 - 知乎
    https://zhuanlan.zhihu.com/p/39281522
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   3051 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 11:06 · PVG 19:06 · LAX 04:06 · JFK 07:06
    ♥ Do have faith in what you're doing.