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