红薯网自动化检测

红薯网自动化检测,第1张

# python
# _*_ coding:utf-8 _*_

from selenium import webdriver
import time
from selenium.webdriver.common.by import By
from PIL import Image
from chaojiying import Chaojiying_Client
bro = webdriver.Chrome(executable_path='./chromedriver.exe')
bro.get('https://so.gushiwen.cn/user/login.aspx?from=http://www.kaotop.com/file/tupian/20220510/collect.aspx')time.sleep(1)bro.save_screenshot('aa.png')

code_img_ele = bro.find_element(By.ID,'imgCode')
location = code_img_ele.location 
print(location)
size = code_img_ele.size  
print(size)

rangle = (
    int(location['x']),int(location['y']),int(location['x']+size['width']),int(location['y']+size['height'])
)


i = Image.open('./aa.png')
code_img_name = './code.png'

frame = i.crop(rangle)
frame.save(code_img_name)

chaojiying = Chaojiying_Client('超级鹰账号', '超级鹰密码', '933013')	
im = open('code.png', 'rb').read()											
pic_str = (chaojiying.PostPic(im, 1902)['pic_str'])

user_num = bro.find_element(By.ID,'email')
user_num.send_keys('账号')
time.sleep(1)

password = bro.find_element(By.ID,'pwd')
password.send_keys('密码')
time.sleep(1)

code = bro.find_element(By.ID,'code')
code.send_keys(pic_str)

a_tag = bro.find_element(By.ID,'denglu')
a_tag.click()

time.sleep(1000000)

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/langs/883318.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-14
下一篇2022-05-14

发表评论

登录后才能评论

评论列表(0条)

    保存