-
Notifications
You must be signed in to change notification settings - Fork 4
/
ChromeLogin.py
36 lines (36 loc) · 1.04 KB
/
ChromeLogin.py
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
from Login import Login,GetInfo
import getpass
import selenium.webdriver
from webdriver_manager.chrome import ChromeDriverManager
#pip3 install selenium webdriver_manager
if __name__=='__main__':
print("一站式网上办事大厅-->教务系统")
username = input("学号:")
password = getpass.getpass("密码:")
session=None
while not session:
try:
session,num = Login(username, password)
if not session:
break
except:
pass
if session:
GetInfo(session, username)
cookies=session.cookies.get_dict()
scookies=[]
for i in cookies:
one={
'name':i,
'value':cookies[i],
'domain':'jw.swu.edu.cn'
}
scookies.append(one)
else:
exit(-1)
driver=selenium.webdriver.Chrome(ChromeDriverManager().install())
driver.get("http://jw.swu.edu.cn")
driver.delete_all_cookies()
for i in scookies:
driver.add_cookie(i)
driver.refresh()