import asyncio

from requests_html import HTMLSession

url  = 'https://passport.baidu.com/v2/?login&tpl=mn&u=http%3A%2F%2Fwww.baidu.com%2F&sms=5'

session = HTMLSession( browser_args=[
'--no-sand',
'--disable-infobars'
'--user-agent=Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36'
],headless=False)
res = session.request(url=url,method='GET')
script = """
() => {
return {
width: document.documentElement.clientWidth,
height: document.documentElement.clientHeight,
deviceScaleFactor: window.devicePixelRatio,
}
}
"""
try:
res.html.render(keep_page = True)
async def main(): await res.html.page.waitFor(1000)
await res.html.page.click(' [id = "TANGRAM__PSP_3__footerULoginBtn"]')
await res.html.page.type(' [id="TANGRAM__PSP_3__userName"]','maonanbei')
await res.html.page.type(' [id="TANGRAM__PSP_3__password"]','goudouxi')
await res.html.page.screenshot({'path': 'login.png'}) await res.html.page.waitFor(100000000)
asyncio.get_event_loop().run_until_complete(main())
except Exception as e:
print(e)
finally:
session.close()

request-html 登陆百度的更多相关文章

  1. 【教程】模拟登陆百度之Java代码版

    [背景] 之前已经写了教程,分析模拟登陆百度的逻辑: [教程]手把手教你如何利用工具(IE9的F12)去分析模拟登陆网站(百度首页)的内部逻辑过程 然后又去用不同的语言: Python的: [教程]模 ...

  2. 使用HttpWebrequest对网站进行模拟操作(附登陆百度demo)

    // a[href=#viewSource]"); //查看源代码标签 viewSourceArr.attr("title", "查看源代码"); v ...

  3. RFS实例登录126邮箱/利用cookie登陆百度

    可以直接添加用户关键字,也可以新建资源,将用户关键字添加入资源,然后导入整个资源文件 用户关键字内部实现如下: 打开126邮箱首页: Open Browser  Http://mail.126.com ...

  4. 模拟登陆百度以及Selenium 的基本用法

    模拟登陆百度,需要依赖于selenium 模块,调用浏览器,执行python命令 先来说一下这个selenium模块啦...... 本文参考内容来自 Selenium官网 SeleniumPython ...

  5. php curl 登陆百度贴吧(经历记录)

    这两天,因为公司需要,所以研究了一下百度文库的登陆方案.因为账号是购买的,只有一部分cookie值,所以不能通过正常的渠道登陆,所以只有通过curl模拟直接进行后台登陆.那么,问题来了.按照人家说的, ...

  6. Selenium模拟登陆百度贴吧

    Selenium模拟登陆百度贴吧 from selenium import webdriver from time import sleep from selenium.webdriver.commo ...

  7. 使用python模拟登陆百度

    #!/usr/bin/python # -*- coding: utf- -*- """ Function: Used to demostrate how to use ...

  8. python selenium 模拟登陆百度账号

    代码: from selenium import webdriver url = 'https://passport.baidu.com/v2/?login' username = 'your_use ...

  9. 呵呵呵呵。。。系统还原了,终于可以用IE登陆百度了

    原文发布时间为:2009-12-19 -- 来源于本人的百度文章 [由搬家工具导入] 呵呵呵呵。。。今天终于有时间把系统还原了,终于可以用IE登陆百度了

随机推荐

  1. LeetCode:字符串相加【415】

    LeetCode:字符串相加[415] 题目描述 给定两个字符串形式的非负整数 num1 和num2 ,计算它们的和. 注意: num1 和num2 的长度都小于 5100.num1 和num2 都只 ...

  2. oracle 添加字段

    alter table 表名 add 新增字段名(类型+长度); #添加字段 alter table asset_orders add remark varchar2(255); #查看 descri ...

  3. Kubernetes 控制器之 Service 讲解(七)

    一.背景介绍 我们这里准备三台机器,一台master,两台node,采用kubeadm的方式进行安装的,安装过程大家可以参照我之前的博文. IP 角色 版本 192.168.1.200 master ...

  4. 机器学习技法总结(一):支持向量机(linear support vector machine,dual support vector machine)

    第一阶段技法: large margin (the relationship between large marin and regularization), hard-SVM,soft-SVM,du ...

  5. ansible的基础使用(一)

    ansible基础使用(一) ansible的主要功能 A:为什么是ansible B:ansible的安装 C:ansible的相关文件 D:ansible的基本使用 ansible的简单操作 A: ...

  6. [转帖]Socat 入门教程

    https://www.hi-linux.com/posts/61543.html 现在安装k8s 必须带 socat 今天看一下socat 到底是啥东西呢. Socat 是 Linux 下的一个多功 ...

  7. 下载 m3u8 直播流的方法

    下载 FFmpeg http://ffmpeg.org/download.html 查找直播流地址 找到目标视频对应的 m3u8 播放列表. 执行脚本 ffmpeg -i https://nhkmov ...

  8. MySQL权限管理常用命令

    1.进入mysql命令行. (1)SSH连接:mysql -u root -p输入root密码 (2)Navicat for MySQL中:右击连接,选择“命令列界面..” 2.mysql环境操作 ( ...

  9. maven工程目录和类加载器ClassLoader的记录

    URL url = this.getClass().getClassLoader().getResource("/" + packageName.replaceAll(" ...

  10. C 风格字符串、string 类要点总结

    1. C风格字符串 1.1 其它 头文件<cstring> 特殊性质:C风格字符串以空字符\0结尾 1.2 读取一行的区别 1.2.1 cin.getline(array1,n,char) ...