Last active
March 7, 2024 12:18
-
-
Save omartrigui/1426a2b243b4f962fc0c410a45f6d6e8 to your computer and use it in GitHub Desktop.
Script: Fahrerlaubnis - Umschreibung einer ausländischen Fahrerlaubnis aus einem Nicht-EU/EWR-Land
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
from selenium.webdriver.common.by import By | |
import time | |
import notify2 | |
import os | |
driver = webdriver.Chrome() | |
notify2.init("Python Notification") | |
while True: | |
driver.get("https://service.berlin.de/dienstleistung/327537/") | |
driver.execute_script("window.scrollTo(0, 3000)") | |
checkbox = driver.find_element(By.XPATH, '//*[@id="checkbox_overall"]') | |
checkbox.click() | |
button = driver.find_element(By.XPATH, "//button[contains(text(), 'Termin buchen')]") | |
button.click() | |
try: | |
page_text = driver.find_element(By.XPATH, '//*[@id="layout-grid__area--herounit"]/div/h1').text | |
except: | |
page_text = "" | |
if "Leider sind aktuell keine Termine" in page_text: | |
time.sleep(30) | |
else: | |
driver.switch_to.window(driver.current_window_handle) | |
os.system("/usr/bin/canberra-gtk-play --id='bell'") | |
notification = notify2.Notification("Title", "Termin verfügbar!") | |
notification.set_urgency(notify2.URGENCY_CRITICAL) | |
notification.show() | |
time.sleep(6000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment