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

selenium 填入 cookie 登入网站 其他网站可以 www2.baidu.com 不能存入 cookie 请问这是什么原因 要如何才能越过登陆 www2.baidu.com

  •  
  •   Nepheshel · 2018-06-11 09:01:52 +08:00 · 2359 次点击
    这是一个创建于 2139 天前的主题,其中的信息可能已经有所发展或是发生改变。
    url = 'https://www2.baidu.com'
    options = webdriver.ChromeOptions()
    options.add_argument('lang=zh_CN.UTF-8')
    options.add_argument("user-agent='Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36'")
    browser = webdriver.Chrome(chrome_options=options)
    browser.get(url)
    cookie1 = {}
    .
    .
    .
    browser.add_cookie(cookie1)
    .
    .
    .
    time.sleep(3)
    browser.refresh()
    2 条回复    2018-06-11 09:34:16 +08:00
    golmic
        1
    golmic  
       2018-06-11 09:09:17 +08:00 via Android
    百度登录,模拟一下 RSA 加密过程,可以用模拟请求的方式做
    Nepheshel
        2
    Nepheshel  
    OP
       2018-06-11 09:34:16 +08:00
    @golmic
    编程新手 刚学习 python 模拟请求指的是 用 request post 方式吗
    主要我想实现自动登陆 点击下载图标 下载每日数据表
    selenium 这个方法看上去 只要找到对应 html 元素 就可以点击下载
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5419 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 06:04 · PVG 14:04 · LAX 23:04 · JFK 02:04
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.