Skip to content
Snippets Groups Projects
Commit d4abf9df authored by Recolic Keghart's avatar Recolic Keghart
Browse files

Initial commit

parents
No related branches found
No related tags found
No related merge requests found
*.log
# HUST 健康状况上报 auto fucker 本科生版
> Tested at Feb 12, 04:03, 2020 (UTC-8).
http://fkfy.hust.edu.cn/jkzksb.htm
## requirements
```bash
sudo pacman -S python-selenium geckodriver
```
Any linux with GUI support. it launches your firefox.
### WARNING: While making this script, I assume that your system language is ENGLISH
uid = 'U201614444'
password = 'Password' # pass.hust.edu.cn
run.py 0 → 100644
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
import config
def wait_for_element(element_txt):
print('Waiting for loading.', end='', flush=True)
while driver.find_elements_by_link_text(element_txt) == []:
print('.', end='', flush=True)
time.sleep(0.2)
print()
driver = webdriver.Firefox()
driver.get("https://yqtb.hust.edu.cn/infoplus/form/BKS/start")
assert "统一身份认证系统" in driver.title
elem = driver.find_element_by_id('un')
elem.clear()
elem.send_keys(config.uid)
elem = driver.find_element_by_id('pd')
elem.clear()
elem.send_keys(config.password)
driver.find_element_by_id('index_login_btn').click()
wait_for_element('下一步 Next step')
assert driver.find_element_by_id('V1_CTRL154').is_selected() # Submit for myself
driver.find_element_by_link_text('下一步 Next step').click()
wait_for_element('提交 Submit')
# I will leave all info as-is.
driver.find_element_by_id('V1_CTRL164').send_keys('36.1')
driver.find_element_by_id('V1_CTRL104').click()
driver.find_element_by_id('V1_CTRL74').click()
try:
driver.find_element_by_id('V1_CTRL172_0').clear()
driver.find_element_by_id('V1_CTRL172_0').send_keys('母亲')
driver.find_element_by_id('V1_CTRL174_0').send_keys('36.1')
driver.find_element_by_id('V1_CTRL184_0').click()
driver.find_element_by_id('V1_CTRL186_0').click()
except:
pass
driver.find_element_by_link_text('提交 Submit').click() # Fucking dynamic id
# Another confirmation. This is a dangerous code.
driver.find_element_by_class_name('default').click()
while 'If you have anything to comment,please click here, or you can add reviews in the form.' == driver.find_element_by_class_name('dialog_content').text:
time.sleep(0.2)
result = driver.find_element_by_class_name('dialog_content').text
if result == 'Done successfully!':
driver.close()
print(result)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment