-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
executable file
·31 lines (29 loc) · 1.29 KB
/
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
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import sys
from subprocess import call
import time
if __name__ == "__main__":
CHROMEDRIVER_PATH = "/usr/local/bin/chromedriver"
WINDOW_SIZE = "1920,1080"
chrome_options = Options()
chrome_options.add_argument("--headless")
chrome_options.add_argument("--window-size=%s" % WINDOW_SIZE)
with webdriver.Chrome(
executable_path=CHROMEDRIVER_PATH, options=chrome_options
) as browser: # Add chrome driver to classpath - e.g. /usr/local/bin on Mac
browser.get("https://www.waangoo.com/deliveryslotdetails")
time.sleep(1)
try:
print("\tTrying to find open slot...\n")
slots = browser.find_element_by_xpath("//td[@style='text-align: center;']")
if slots is not None:
print("\tFound open slot!\n")
# Increase Mac volume to 100%
call(["osascript -e 'set volume output volume 100'"], shell=True)
audio_file = "/System/Library/Sounds/Glass.aiff"
for i in range(50):
return_code = call(["afplay", audio_file]) # Works on Mac
# print('\a\a\a\a\a\a\a\a\a') # For windows may be
except:
print("\tNo open slot!\n")