-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.py
29 lines (20 loc) · 909 Bytes
/
utils.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
from time import sleep
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from webdriver_manager.chrome import ChromeDriverManager
from constants import PAUSE_DURATION_SECONDS_SELENIUM, URL
def get_copout():
service = Service(executable_path=ChromeDriverManager().install())
options = Options()
options.add_argument("--headless")
driver = webdriver.Chrome(service=service, options=options)
driver.get(URL)
driver.maximize_window()
sleep(PAUSE_DURATION_SECONDS_SELENIUM)
press_button = driver.find_element(By.LINK_TEXT, 'Сгенерировать отмазку')
press_button.click()
sleep(PAUSE_DURATION_SECONDS_SELENIUM)
copout_text = driver.find_element(By.CLASS_NAME, 'wrap-excuse__middle')
return copout_text.text