推荐学习书目
› 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
vagrantear
V2EX  ›  Python

selenium 怎么实现通过添加 cookie 免登录

  •  
  •   vagrantear · Apr 28, 2020 · 4989 views
    This topic created in 2393 days ago, the information mentioned may be changed or developed.
    同标题
    9 replies  •  2020-04-30 17:45:57 +08:00
    yaoye555
    yaoye555
    Apr 28, 2020
    1
    善用搜索
    vagrantear
    vagrantear
    OP
    Apr 28, 2020
    2
    道理我都懂,我查出来的方法都失效了,我才来提问的 :)
    zcxey2911
    zcxey2911
    Apr 28, 2020
    3
    请使用 driver.add_cookie(cookie)
    vagrantear
    vagrantear
    OP
    Apr 29, 2020
    4
    @zcxey2911 用了,我还特意用 selenium 抓了 cookie,f12 的 cookie 都试过,还是不行。
    aaronhua
    aaronhua
    Apr 30, 2020
    5
    yyb123456789
    yyb123456789
    Apr 30, 2020
    6
    driver.add_cookie(cookie) 请添加必要的参数,最后比照下可用的请求 Cookies 和不可用的差别,深度的自定义添加过程
    vagrantear
    vagrantear
    OP
    Apr 30, 2020
    7
    @yyb123456789 有点云里雾里,请问下有这方面的资料可以借鉴吗
    vagrantear
    vagrantear
    OP
    Apr 30, 2020
    8
    @aaronhua
    我是这样写的,已经提前用 selenium 获取过 cookie 了,存起来,后续再使用就没用了。
    vagrantear
    vagrantear
    OP
    Apr 30, 2020
    9
    ”httponly 如果值为 True,则无法通过该方式登陆",是这个原因吗,难受了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   964 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 19:45 · PVG 03:45 · LAX 11:45 · JFK 14:45
    ♥ Do have faith in what you're doing.