进入实验室之前需要刷实验室安全的课程并通过考试,这儿有两个脚本可以自动化完成
刷时长脚本
需要安装selenium库:pip install selenium
修改user_name为学号,password为登录办事大厅的密码
随后执行脚本
脚本缺点,部分题目需要手动切换网页刷新
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
   | from selenium import webdriver from selenium.webdriver.common.by import By import time
  LOGIN_URL = "http://10.22.107.77"
  user_name = "account"   password = "password"    
  driver = webdriver.Edge()
  driver.get(LOGIN_URL)
  login_btn = driver.find_element(By.XPATH, "/html/body/div/div/div/div[2]/div/div/div[2]/input")
  login_btn.click()
  time.sleep(3)
  user_name_input = driver.find_element(By.XPATH, '//*[@id="username"]') user_name_input.send_keys(user_name) password_input = driver.find_element(By.XPATH, '//*[@id="password"]') password_input.send_keys(password)
  post_btn = driver.find_element(By.XPATH, '/html/body/div/div[2]/div[2]/div[2]/div[2]/div/div[3]/div/div[1]/form/p[4]/button') post_btn.click()
  time.sleep(3)
  learn_gate_btn = driver.find_element(By.XPATH, '/html/body/div[1]/div[2]/ul/li[4]/a') learn_gate_btn.click()
  time.sleep(3)
  all_url_ul = driver.find_element(By.XPATH, '/html/body/div[2]/div[2]/div[1]/ul') all_url_href = all_url_ul.find_elements(By.TAG_NAME, "li")
  all_url_list = [] for idx, item in enumerate(all_url_href):     a = item.find_element(By.TAG_NAME, "a")     href = a.get_attribute("href")     print(href)     all_url_list.append(href)
  all_url_list.append('http://10.22.107.77/redir.php?catalog_id=132&object_id=2590')  
  driver.find_element(By.XPATH, '/html/body/div[1]/div[2]/ul/li[5]/a').click()
  all_a_in_td = driver.find_element(By.XPATH, '/html/body/div[2]/div[3]/div[2]/table/tbody').find_elements(By.TAG_NAME, 'a') for idx, item in enumerate(all_a_in_td):     print(item.get_attribute("href"))     all_url_list.append(item.get_attribute("href"))
  for idx, item in enumerate(all_url_list):     driver.execute_script("window.open('');")     driver.switch_to.window(driver.window_handles[idx + 1])     driver.get(item)          time.sleep(2)     try:         driver.find_element(By.XPATH, '/html/body/div[2]/div[3]/div[2]/ul/li[1]/a[2]/h2').click()     except:         print('others')     time.sleep(.2)
  url_len = len(all_url_list)
  while True:     time.sleep(4 * 60)     for i in range(url_len):         driver.switch_to.window(driver.window_handles[i + 1])         driver.refresh()
 
 
 
   | 
 
答题脚本
几秒内100%正确答题完成
- 需要浏览器先安装Tampermonkey
 
- 下载脚本,地址:https://greasyfork.org/zh-CN/scripts/391130
 
- 打开答题网页,脚本将自动执行:http://10.22.107.77/redir.php?catalog_id=6&cmd=dati
 
此脚本已经适配宁波大学,如果不适配或者答题网页的url发生变化,请在自行修改脚本,将下面的10.22.107.77换成新的答题网页url后放在脚本内(很明显就知道放在哪儿),注意’//'不可去除