V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
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
caitingt
V2EX  ›  Python

Selenium Py Chrome 如何在请求头添加 Proxy-Authorization

  •  
  •   caitingt · May 31, 2018 · 4037 views
    This topic created in 2901 days ago, the information mentioned may be changed or developed.
    from selenium import webdriver

    def create_webdriver():
    options = webdriver.ChromeOptions()
    options.add_argument('--User-Agent=xxxx')
    options.add_argument('--Proxy-Authorization=xxxxx')
    browser = webdriver.Chrome(chrome_options=options)
    return browser


    def main():
    url = 'http://www.baidu.com'
    browser = create_webdriver()
    browser.get(url)

    chrome 是不允许添加 header 吗,请求的头部并没有我添加的参数。有小伙伴遇到这种问题吗?
    3 replies    2018-06-29 15:44:48 +08:00
    sunfei2
        1
    sunfei2  
       Jun 26, 2018
    你好 这个问题你解决了吗 我现在也遇到这个问题了 不知道怎么解决
    caitingt
        2
    caitingt  
    OP
       Jun 27, 2018
    没解决呢,可以试试 phantomjs
    sunfei2
        3
    sunfei2  
       Jun 29, 2018
    @caitingt 额 我的需求没法使用 phantomjs 哪个站点可以识别 phantomjs 被反了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3008 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 07:14 · PVG 15:14 · LAX 00:14 · JFK 03:14
    ♥ Do have faith in what you're doing.