用超级鹰干超级鹰_验证码_登录

超级鹰网址:http://www.chaojiying.com/user/login/
from selenium.webdriver import ChromiumEdge
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
import time
from chaojiying import Chaojiying_Client

# # 无头设置
# opt = Options()
# opt.add_argument("--headless") # 头短小
# opt.add_argument("--disable-gpu")
# options=opt
web = ChromiumEdge()
web.get('http://www.chaojiying.com/user/login/')

# 扣 拿到验证码图片 screenshot 屏幕快照,截屏
# .screenshot() 保存到某一个文件里边
# .screenshot_as_png 保存成 png ,返回相当于一个字节
# .screenshot_as_base64 把图片转成b64,字符串
png = web.find_element(By.XPATH, '/html/body/div[3]/div/div[3]/div[1]/form/div/img').screenshot_as_png

# 超级鹰使用
chaojiying = Chaojiying_Client('18614075987', 'q6035945', '919889') # 账号,密码,软件ID
result = chaojiying.PostPic(png, 1004) # 图片位置,验证码类型
# print(result)
v_code = result['pic_str']
time.sleep(3)

# 用户登录
# 输入验证码
web.find_element(By.XPATH, '/html/body/div[3]/div/div[3]/div[1]/form/p[3]/input').send_keys(v_code)
time.sleep(3)
# 登录用户名
web.find_element(By.XPATH, '/html/body/div[3]/div/div[3]/div[1]/form/p[1]/input').send_keys("18614075987")
time.sleep(3)
# 登录密码
web.find_element(By.XPATH, '/html/body/div[3]/div/div[3]/div[1]/form/p[2]/input').send_keys("q6035945")
time.sleep(3)
# 点击登录
web.find_element(By.XPATH, '/html/body/div[3]/div/div[3]/div[1]/form/p[4]/input').click()
posted @ 2023-08-05 14:49  严永富  阅读(79)  评论(0)    收藏  举报