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
caitingt
V2EX  ›  Python

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

  •  
  •   caitingt · 2018-05-31 14:23:52 +08:00 · 3639 次点击
    这是一个创建于 2150 天前的主题,其中的信息可能已经有所发展或是发生改变。
    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 条回复    2018-06-29 15:44:48 +08:00
    sunfei2
        1
    sunfei2  
       2018-06-26 14:42:32 +08:00
    你好 这个问题你解决了吗 我现在也遇到这个问题了 不知道怎么解决
    caitingt
        2
    caitingt  
    OP
       2018-06-27 18:02:57 +08:00
    没解决呢,可以试试 phantomjs
    sunfei2
        3
    sunfei2  
       2018-06-29 15:44:48 +08:00
    @caitingt 额 我的需求没法使用 phantomjs 哪个站点可以识别 phantomjs 被反了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2772 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 12:41 · PVG 20:41 · LAX 05:41 · JFK 08:41
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.