-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebmonitor.py
More file actions
46 lines (35 loc) · 1.3 KB
/
Copy pathwebmonitor.py
File metadata and controls
46 lines (35 loc) · 1.3 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
44
45
46
import time
import winsound
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.firefox.options import Options
import webbrowser
import win32gui
import win32con
options = Options()
options.headless = True
url = "https://nesnezeno.eco/produkt/foodora-market-balicek-plzen/"
# vybereme prohlížeč a otevřeme webovou stránku
driver = webdriver.Firefox(options=options)
driver.get(url)
# počkáme než se stránka spustí
wait = WebDriverWait(driver, 10)
# odkliknutí cookies
button = wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR, '#CybotCookiebotDialogBodyLevelButtonLevelOptinAllowAll')))
button.click()
print("Program monitouje...\n")
while (True):
driver.refresh()
element = driver.find_element(By.CSS_SELECTOR,'.stock-status')
if(element.text == "Skladem"):
print("Je to skladem, kupujeme!")
driver.quit()
webbrowser.open(url)
hwnd = win32gui.GetForegroundWindow()
win32gui.ShowWindow(hwnd, win32con.SW_MAXIMIZE)
winsound.PlaySound('alarm',0)
break
time.sleep(1) # Počkejte sekundu před dalším načtením stránky
# otevři nesnezeno v edge