-
Notifications
You must be signed in to change notification settings - Fork 0
/
Login.py
79 lines (67 loc) · 2.37 KB
/
Login.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
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
76
77
78
79
import time
import json
import selenium.common.exceptions
from selenium.webdriver.common.by import By
from selenium import webdriver
chrome_options = webdriver.ChromeOptions()
settings = {
"recentDestinations": [{
"id": "Save as PDF",
"origin": "local",
"account": ""
}],
"selectedDestinationId": "Save as PDF",
"version": 2,
"isHeaderFooterEnabled": False,
"isCssBackgroundEnabled": True
}
chrome_options.add_argument('--enable-print-browser')
# chrome_options.add_argument('--headless')
prefs = {
'printing.print_preview_sticky_settings.appState': json.dumps(settings),
'savefile.default_directory': r'C:\Users\batsi\PycharmProjects\Ege_Cheater'
}
chrome_options.add_argument('--kiosk-printing')
chrome_options.add_experimental_option('prefs', prefs)
class PdfLeaker:
def __init__(self, url):
self.driver = webdriver.Chrome(options=chrome_options)
self.url = url
self.login = "he@gmail.com"
self.password = "123"
def log_in(self):
self.driver.get("https://ege.sdamgia.ru")
time.sleep(3)
while True:
try:
email_field = self.driver.find_element(By.ID, "email")
email_field.send_keys(self.login)
password_field = self.driver.find_element(By.ID, "current-password")
password_field.send_keys(self.password)
time.sleep(0.4)
password_field.submit()
time.sleep(0.4)
break
except selenium.common.exceptions.NoSuchElementException:
time.sleep(2)
def leak(self):
# self.driver.get(self.url)
# time.sleep(0.4)
#
# link = self.driver.find_element(By.LINK_TEXT, 'Версия для печати и копирования в MS Word')
#
# link.click()
# time.sleep(1)
self.driver.get(f"{self.url}&print=true")
time.sleep(2)
self.driver.find_element(By.CSS_SELECTOR, "input#cb_ans").click()
self.driver.find_element(By.CSS_SELECTOR, "input#cb_sol").click()
self.driver.execute_script('window.print();')
self.driver.close()
def run(self):
self.log_in()
self.leak()
print('Requests completed')
if __name__ == "__main__":
solver = PdfLeaker('https://math-ege.sdamgia.ru/test?id=74921366')
solver.run()