1.安装包
pip3 install rpa=1.48.1 pip3 install muggle-ocr=1.0.3
如果muggle-ocr使用pip3安装不了,只能手动安装。
百度网盘:https://pan.baidu.com/s/1K3Tq9Vz-u3oQ8tWUXBweTg
提取码:zfxi
2.代码片段
import rpa as r import muggle_ocr def main(): r.init(visual_automation=True,chrome_browser=True) r.url('http://www.12333.gov.cn/cas/siLogin?client=goviam&service=http%3A%2F%2Fsi.12333.gov.cn%2F160469.jhtml&flag=false') # #输入账号密码 r.type('//*[@id="userName"]','123456') r.type('//*[@id="pwd"]','123456') r.snap('//*[@id="img_captcha"]','./yzm.png') with open(r"./yzm.png", "rb") as f: b = f.read() # ModelType.Captcha 可识别4-6位验证码 sdk = muggle_ocr.SDK(model_type=muggle_ocr.ModelType.Captcha) text = sdk.predict(image_bytes=b) r.type('//*[@id="yz_text"]',text) if __name__ == '__main__': main()
标签:__,rpa,muggle,ocr,type,id From: https://www.cnblogs.com/i-tao/p/17076716.html