python reptile code issues

Today reptiles originally wanted to write a program to automatically log online school dean, but the code was stumped, really nerve-racking, write down, I think later.

1.selenium drive browser in the user name and password input box input box, enter the user name and password

from selenium import webdriver
from yundama import YDMHttp
import time
import requests
from urllib import request

#1.驱动浏览器输入用户名和密码
driver=webdriver.Chrome(executable_path="D:\ChromeDriver\chromedriver_win32\chromedriver.exe")
driver.get("http://202.199.224.24:11089/newacademic/common/security/login.jsp")
adminnameinputTag=driver.find_element_by_name('adminname')
adminnameinputTag.send_keys('1606110227')
passwordinputTag=driver.find_element_by_name('password')
passwordinputTag.send_keys('342622199912223218')

It will enter the following interface

so that the Senate completed the online interface to enter a user name and password

2. Download the code to a local

#2.下载验证码
url='http://202.199.224.24:11189/academic/common/security/check1.jsp'
response=requests.get(url)
request.urlretrieve(url,'yzm.jpg')

Just get this step verification code and verification code when signing is not the same, do not know how to solve, write down

3. fight with cloud platform code parsing code

#3.云打码平台解析验证码
ydm = YDMHttp(username='i_panda_',password='ZWQ15350982026')
uid = ydm.login()
if not uid:
    print("登录失败!")

balance = ydm.balance()
if balance < 10:
    print("余额不足!")

_,result = ydm.decode(filename='yzm.jpg',codetype="4004")
print(result)

yzminputTag=driver.find_element_by_name('useryz')
yzminputTag.send_keys(result)

4. Click Login

#4.点击登录
button1=driver.find_element_by_name('button1')
button1.click()

However, some do not always perfect place
Here Insert Picture Description

···································· adjourned to next time

Published 24 original articles · won praise 8 · views 1191

Guess you like

Origin blog.csdn.net/qq_41739233/article/details/104096179