This repository was archived by the owner on Aug 21, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaccess.py
More file actions
43 lines (35 loc) · 1.34 KB
/
access.py
File metadata and controls
43 lines (35 loc) · 1.34 KB
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
from selenium import webdriver
import subprocess, signal
import os, time
from private_val import EMAIL, PWD
root = 'http://localhost:8080/notify/'
target = root + 'auth'
goal = root + 'auth/complete'
driver = webdriver.Safari()
driver.get(target)
if not driver.current_url == target:
print('sign in zoom')
email = driver.find_element_by_id('email')
email.send_keys(EMAIL)
password = driver.find_element_by_id('password')
password.send_keys(PWD)
sign_in = driver.find_element_by_css_selector('#login-form > div:nth-child(4) > div > div.signin > button')
sign_in.click()
time.sleep(2)
while True:
if driver.current_url == goal or driver.current_url == root:
print(f'current url is {driver.current_url}.')
print('quit the driver.')
driver.quit()
break
p = subprocess.Popen(['ps', '-A'], stdout=subprocess.PIPE) # 'ps -A'の実行,標準出力に対するパイプの解放
out, err = p.communicate() # プロセスから標準出力と標準エラー出力を取得
for line in out.splitlines():
if 'ngrok' in line.decode():
print('kill ngrok process')
pid = int(line.split(None, 1)[0])
os.kill(pid, signal.SIGKILL)
if 'manage.py' in line.decode():
print('kill manage.py process')
pid = int(line.split(None, 1)[0])
os.kill(pid, signal.SIGKILL)