谷歌浏览器selenium,30行代码自动申请出校

学校改成报备制之后,批量申请了半年的出校哈哈

但这也是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()

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值