更新于2021年11月25日
尝试通过selenium包进行每日一报,后期可能通过window自带计划功能实现每天定时定点完成每日一报
使用前需安装selenium包
from selenium import webdriver
import time
from tkinter import messagebox
bro = webdriver.Edge()
u = '账户'
p = '密码'
# 输入用户名和密码
bro.get('https://cas.paas.lixin.edu.cn/cas/login?service=http%3A%2F%2Fmcenter.lixin.edu.cn%2Findex.jsp')
username =bro.find_element_by_name('username')
time.sleep(1)
username.send_keys(u)
password =bro.find_element_by_name('password')
time.sleep(1)
password.send_keys(p)
time.sleep(1)
bro.find_element_by_name("submit").click()
bro.get('https://mcenter.lixin.edu.cn/r/w?sid=70213f88-a96a-4f8c-8f00-4eb59e0e5320&cmd=CLIENT_BPM_FORM_MAIN_PAGE_OPEN&processInstId=c9fdc52b-9481-4a81-a158-075f812f605b&openState=0&formDefId=6c50ebbe-873c-4c03-97ca-e0d9bd54eddc&boId=3de8f1d0-a418-47e1-b7f6-dafdfb11c788&lang=cn&displayToolbar=true')
time.sleep(3)
bro.find_element_by_id("selCity_SF").find_element_by_css_selector("option[value='3101']").click()
bro.find_element_by_id("selArea_SF").find_element_by_css_selector("option[value='310115']").click()
time.sleep(1)
if time.localtime().tm_hour>12:
bro.find_element_by_id('XW').click()
else:
bro.find_element_by_id('SW').click()
time.sleep(1)
bro.find_element_by_id('comboBoxActionSheetContent').find_element_by_css_selector("[value='0']").click()
bro.find_element_by_id('BTN_SAVE').click()
bro.quit()
#messagebox.showinfo('提示','已完成每日一报')
|