学校改成报备制之后,批量申请了半年的出校哈哈
但这也是21年末的代码了,学校的系统也在更新换代,这里做个记录
有空再详细写教程
最近也在每日按时如实报平安
from selenium import webdriver
wd = webdriver.Chrome(r'F:\python3.9.7\chromedriver.exe')
wd.implicitly_wait(40)
wd.get('http://cas.bjfu.edu.cn/cas/login?service=https%3A%2F%2Fi.bjfu.edu.cn%2Ftp_up%2Fview%3Fm%3Dup')
wd.find_element_by_id('un').send_keys('这里改成账户')
wd.find_element_by_id('pd').send_keys('这里改成密码')
wd.find_element_by_id('index_login_btn').click()
#插入报平安字段
for i in range(13,32):#当月的日期
wd.implicitly_wait(40)
wd.get('https://s.bjfu.edu.cn/tp_fp/view?m=fp#from=hall&serveID=7ca5c262-3add-4f3d-b1d9-b1fa054e5cae&act=fp/serveapply')
element = wd.find_element_by_css_selector('.layui-layer-btn0')
element.click()
wd.switch_to.frame('formIframe')
wd.find_element_by_id('CXSY').send_keys('外出')
js = "$('#JHCXSJ').attr('readonly',false)"
wd.execute_script(js)
input_datetime = wd.find_element_by_id('JHCXSJ')
date_string = "2022-01-" + str(i)#记得改月份
input_datetime.send_keys(date_string)
element = wd.find_element_by_xpath('//*[@id="CXCN_vant"]/div/div/div/i')
element.click()
wd.switch_to.default_content()
wd.find_element_by_id('commit').click()
import time
time.sleep(3)
wd.quit()