济南大学综合测评德育分自动化打分脚本

一、脚本功能

本脚本实现了济南大学综合测评德育分的自动化打分。

二、运行环境

Python3 + Selenium + Chrome + Chromedriver
注意!运行环境请自行配置,这里只提供下载链接和安装命令!
Python3点击下载;提取码:6666
Selenium:通过pip命令安装pip install selenium
Chrome点击下载
Chromedriver点击下载(驱动版本需跟Chome浏览器版本对应,下载完后放到Python目录下即可)

三、脚本效果展示

济南大学综合测评德育分自动化打分效果视频

四、代码详情

from selenium import webdriver
import time


# 自动填写综合测评的脚本
def script(PhoneNumber, Password):
    mobileEmulation = {'deviceName': 'iPhone 6/7/8 Plus'}  # 设置脚本的手机型号
    options = webdriver.ChromeOptions()  # 实例化浏览器选项
    options.add_experimental_option('mobileEmulation', mobileEmulation)  # 添加手机型号选项到浏览器
    Driver = webdriver.Chrome(executable_path='chromedriver.exe', chrome_options=options)  # 实例化驱动
    Driver.maximize_window()  # 最大化窗口
    Driver.get("https://zhcp.ujnxgzx.com/")  # 访问综合评价URL
    # 输入手机号和密码
    Driver.find_element_by_xpath("//div[@class='container component']/input[@type='text']").send_keys(PhoneNumber)
    Driver.find_element_by_xpath("//div[@class='container component']/input[@type='password']").send_keys(Password)
    Driver.find_element_by_xpath("//div[@class='container component']/button").click()  # 点击登录
    time.sleep(1)  # 让程序睡一会,不能删除,否则会出错
    Cnt1 = len(Driver.find_elements_by_xpath("//div[@id='PERSONS']/div"))  # 获取需要评价的学生总数
    for i in range(1, Cnt1 + 1):  # 遍历每一个学生
        Driver.find_element_by_xpath("//div[@id='PERSONS']/div[" + str(i) + "]/div/span[1]").click()  # 进入打分详情页
        print(Driver.find_element_by_xpath("//div[@class='van-nav-bar__title van-ellipsis']").text + ":评分已完成")
        Cnt2 = len(Driver.find_elements_by_xpath("//div[@class='candidate_message']/ul"))  # 获取打分选项
        for j in range(1, Cnt2 + 1):  # 遍历每一个打分项
            Driver.find_element_by_xpath("//div[@class='candidate_message']/ul[" + str(j) + "]//input").send_keys(
                "100")  # 输入分数(不用担心分数溢出,如果分数溢出,该页面的前端会自动设置成最大分)
        Driver.find_element_by_xpath("//div[@class='candidate_message']/div/button").click()  # 点击提交评分
        time.sleep(1)
    Driver.find_element_by_xpath("//div[@class='submit']").click()
    time.sleep(2)
    Driver.find_element_by_xpath(
        "//div[@class='van-hairline--top van-dialog__footer van-dialog__footer--buttons']/button[@class='van-button"
        " van-button--default van-button--large van-dialog__confirm van-hairline--left']").click()


if __name__ == '__main__':
    Tel = "填写你的手机号"  # 手机号
    Pwd = "填写你的密码"  # 密码
    script(Tel, Pwd)  # 调用脚本方法

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

达娃里氏

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值