-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
35 lines (24 loc) · 1006 Bytes
/
main.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
from selenium import webdriver
from selenium.webdriver.firefox.service import Service
from selenium.webdriver.firefox.options import Options
import time
options = Options()
geckodriver_path = "./geckodriver"
service = Service(geckodriver_path)
driver = webdriver.Firefox(service=service, options=options)
driver.get('https://example.com/')
time.sleep(2)
def execute_code_from_file(path):
with open(path, 'r') as file:
code = file.read()
exec(code)
while True:
input("[" + time.strftime("%H:%M:%S") + "] Read file? (Press Enter to continue) ===============================")
print("===============================================================================")
try:
execute_code_from_file('dynamic.py')
except Exception as e:
print(f"Произошла ошибка: {e}")
finally:
print("[" + time.strftime("%H:%M:%S") + " Done!")
print("===============================================================================")