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
    
  • 相关阅读:
    提升工作效率的方法
    Spark Streaming 实现思路与模块概述
    Reduce Side Join实现
    File file:/data1/hadoop/yarn/local/usercache/hp/appcache/application_* does not exi
    Caused by: java.io.IOException: Filesystem closed的处理
    linux下nproc的作用
    Spark Streaming 的一些问题
    php代码审计7审计csrf漏洞
    php代码审计6审计xss漏洞
    php代码审计5审计命令执行漏洞
  • 原文地址:https://www.cnblogs.com/Shimarin/p/14486931.html
Copyright © 2011-2022 走看看