zoukankan      html  css  js  c++  java
  • 选课人看了会流泪,教务处看了会沉默的神秘代码

    选课人看了会流泪,教务处看了会沉默的神秘代码

    """
    This is a script to choose your FAVOURITED curriculums on the NEW EASystem of NJU.
    It only works for students able to login via the General Authentication System.
    
    It's necessary to install the library request, selenium, and the geckodriver of FireFox first
    """
    
    import time
    import urllib.request
    from selenium import webdriver
    
    driver = webdriver.Firefox()
    
    url = "http://xk.nju.edu.cn"
    StudentId = "REPLACE WITH YOUR OWN ID"
    PassWord = "REPLACE WITH YOUR OWN PASSWORD" 
    
    driver.get(url)
    
    # Login via the General Authentication System
    driver.find_elements_by_id('username')[0].send_keys(StudentId)
    driver.find_elements_by_id('password')[0].send_keys(PassWord)
    driver.find_element_by_css_selector("#casLoginForm > p:nth-child(4) > button:nth-child(1)").click()
    time.sleep(0.1)
    
    # Here try except to avoid the unnecessarity to choose a mode
    try:
        # Replace the 0 in the next line to choose different mode
        driver.find_elements_by_xpath('.//*[@name="electiveBatchSelect"]')[0].click()
        driver.find_element_by_xpath('.//*[@type="button" and @data-index="0"]').click()
    except: pass
    driver.find_element_by_id('courseBtn').click()
    
    while True:
        driver.refresh()
        time.sleep(0.2)
        driver.find_element_by_xpath('//a[text()="收藏"]').click()
        curriculums = driver.find_elements_by_xpath('.//*[text()="选择"]')
    
        # Try to choose each of the favourited curriculum regardless of the feasibility
        for each in curriculums:
            try:
                each.click()
                driver.find_element_by_xpath('.//*[@data-type="sure"]').click()
                time.sleep(0.3)
                driver.find_element_by_xpath('.//*[@data-type="sure"]').click()
            except: pass
    
  • 相关阅读:
    02 nginx 进程结构_热部署_nginx虚拟主机
    Go基础
    01 nginx 概述及安装
    项目--微信小程序
    小程序框架
    常用数据集合
    看正月点灯笼老师的笔记—线段树
    并查集—汇总
    看正月点灯笼老师的笔记—qsort 和 bsearch
    看正月点灯笼老师的笔记—BFS和DFS ( 3 )
  • 原文地址:https://www.cnblogs.com/Shimarin/p/14486931.html
Copyright © 2011-2022 走看看