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 年 5 月 31 日 · 3976 次点击
    这是一个创建于 2864 天前的主题,其中的信息可能已经有所发展或是发生改变。
    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 年 6 月 26 日
    你好 这个问题你解决了吗 我现在也遇到这个问题了 不知道怎么解决
    caitingt
        2
    caitingt  
    OP
       2018 年 6 月 27 日
    没解决呢,可以试试 phantomjs
    sunfei2
        3
    sunfei2  
       2018 年 6 月 29 日
    @caitingt 额 我的需求没法使用 phantomjs 哪个站点可以识别 phantomjs 被反了
    关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   897 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 19:45 · PVG 03:45 · LAX 12:45 · JFK 15:45
    ♥ Do have faith in what you're doing.