-
Notifications
You must be signed in to change notification settings - Fork 0
/
connector.py
34 lines (28 loc) · 1.06 KB
/
connector.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
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
# Initialize the driver here
driver = None
def initialize_driver():
chrome_options = Options()
chrome_options.binary_location = '/usr/bin/google-chrome'
chrome_options.add_argument("--disable-gpu")
chrome_options.add_argument("--disable-dev-shm-usage")
chrome_options.add_argument("--no-sandbox")
driver = webdriver.Chrome(options=chrome_options)
return driver
# Вход на сайт
def login(driver, login, password, login_url):
driver.get(login_url)
login_element = driver.find_element(By.ID, "mui-1")
password_element = driver.find_element(By.ID, "mui-2")
login_element.send_keys(login)
password_element.send_keys(password)
password_element.send_keys(Keys.ENTER)
# Общие переменные, функции и классы
parser_thread = None
stop_parsing = False
parser_start_time = None
parser_running = False
# chat_id = 1273830101