Reputation: 1
Im new to programming and as a first project I wanted to write a script in Python with Selenium that can check my schools website and give me a notification when I receive a new grade. I already wrote a code in Python with Selenium that logs in to my account and goes to my grades. But what I don't know is how to let it constantly check for new grades and that when there is a new one, it sends me a notification to my iPhone via SMS, Whatsapp, email or another way. I really hope that someone has time to answer my question! Thanks a lot!
Here is the code I wrote so far (I replaced sensitive information with ******* so that you can't see it ;)
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
PATH = "/Users/***********/Documents/chromedriver"
driver = webdriver.Chrome(PATH)
driver.get("https://minkema.magister.net/magister/#/cijfers")
search = driver.find_element_by_id("username")
search.send_keys("******")
search.send_keys(Keys.RETURN)
try:
password_login = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.ID, "rswp_password"))
)
except:
driver.quit()
password_inloggen = driver.find_element_by_id("rswp_password")
password_inloggen.send_keys("*********")
password_inloggen.send_keys(Keys.RETURN)
Upvotes: 0
Views: 177
Reputation: 43
First, you'll need to use some scheduler like a cronjob to check the site periodically then you'll have to use a database to store the grades that are already sent to you so it won't be sent every time the script runs. and as a notification tool, I would recommend using a Telegram bot.
Upvotes: 1