当前位置:网站首页>selenium处理验证码
selenium处理验证码
2022-07-18 23:17:00 【芒着可爱】
处理验证码的方法
- 图像识别
- 选择互联网上成熟的验证码破解工具
图像识别(待补充)
对于不同的页面,验证码可能有所差异,所以目前不推荐
使用 超级鹰 破解
- 进入超级鹰官网的登陆页面
- 登录注册后,进入界面,对于新人,扫描最下面的二维码关注公众号即可获得积分1000
- 选择开发文档,选择语言后下载
- 解压,将chaojiying.py打开,该文件是python2版本的,使用需要适当的修改一下代码,只需要修改main里面的内容,(可能是缩进,可能是他的print写错了)
- 如图:验证码类型可以查看官网
案例:使用超级鹰登录超级鹰(破解验证码)
import time
from selenium.webdriver import Chrome
from chaojiying import Chaojiying_Client
web = Chrome()
web.get('http://www.chaojiying.com/user/login/')
# 处理验证码
img = web.find_element_by_xpath('/html/body/div[3]/div/div[3]/div[1]/form/div/img').screenshot_as_png
# !!! 注意修改
chaojiying = Chaojiying_Client('超级鹰用户名', '超级鹰用户名的密码', '96001')
dic=chaojiying.PostPic(img,1902)
verify_code = dic['pic_str']
print(verify_code)
# 向页面中填入用户名,密码,验证码
web.find_element_by_xpath('/html/body/div[3]/div/div[3]/div[1]/form/p[1]/input').send_keys('3133893491')
web.find_element_by_xpath('/html/body/div[3]/div/div[3]/div[1]/form/p[2]/input').send_keys('Trc_Hxm717')
web.find_element_by_xpath('/html/body/div[3]/div/div[3]/div[1]/form/p[3]/input').send_keys(verify_code)
time.sleep(5)
#点击登录
web.find_element_by_xpath('/html/body/div[3]/div/div[3]/div[1]/form/p[4]/input').click()
web.close()
边栏推荐
- Apache Hudi data skip technology accelerates queries up to 50 times
- 安全研究人员发现针对工业运营商的恶意软件
- College sales turned to software testing, from 4K in the third line to 20k in the first line. I pushed another door open
- 父子同名属性,直接访问和通过方法访问的区别
- UML类图关系(泛化 、继承、实现、依赖、关联、聚合、组合)
- Install harbor on tke
- Information system project managers must recite the core examination points (45) Bidding Law
- The safety situation of Air India's airliners is frequent. Indian media said that 30 flight failures occurred on average every day
- [software testing] how to learn mobile terminal testing? Super detailed app testing strategy
- Unable to use voice input
猜你喜欢
Learn about spark project on nebulagraph
像素专业版Graph可视化操作入门
UML类图关系(泛化 、继承、实现、依赖、关联、聚合、组合)
安全研究人员发现针对工业运营商的恶意软件
WSL2 通过 USBIP 连接USB串口设备 JetsonUSB备份刷机
【编程题】【Scratch二级】2020.12 森林聚会
【经验分享】强力推荐——截图小工具Faststone Capture(FSC)
在线随机抛硬币正反面统计工具
得物基于Attach to Process的实时调试实践
Developers must read: 2022 mobile application operation growth insight white paper
随机推荐
Usage and meaning of [optional chain], [null value merging operator] and [null value assignment operator] of JS
Developers must read: 2022 mobile application operation growth insight white paper
互联网大厂智能座舱斗法
华泰证券网上开户安全吗?网上开户佣金最低多少
值得一看的智能运维AIOps关键核心技术概览!
剑指Offer 42:连续子数组的最大和
Share | 2022 big data white paper of digital security industry (PDF attached)
Working for 3 months, my understanding of testing work
Wdsr paper reading notes
折线图展示数据趋势的同时还能数据筛选
自从测试部新来了个00后卷王,老油条感叹真干不过,但是...
Math. LM method of net optimization method
The safety situation of Air India's airliners is frequent. Indian media said that 30 flight failures occurred on average every day
关于extern声明&定义
Learn about spark project on nebulagraph
每周 Postgres 世界动态 2022w28
Real time debugging practice based on attach to process
Istio architecture extension mechanism
安全研究人员发现针对工业运营商的恶意软件
Wsl2 connects the USB serial port device jetsonusb backup brush through usbip