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


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

    """
    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
    
  • 相关阅读:
    Building a Basic .NET Remoting Application
    Building a Basic .NET Remoting Application 之一 Building a Remotable Type
    Type Library Exporter (Tlbexp.exe)
    .NET Remoting Architecture
    Runtime Hosts
    Building a Basic .NET Remoting Application 之二 Building a Host Application
    Building a Basic .NET Remoting Application 之三 Building a Client Application
    C语言字符串大全(转自百度百科)
    作业 双向链表
    递推练习 简单n!
  • 原文地址:https://www.cnblogs.com/Shimarin/p/14486931.html
Copyright © 2020-2023  润新知