In [115]:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
In [116]:
driver = webdriver.Chrome("/Users/stanpol/Downloads/chromedriver")
driver.get("https://selfservice.udi.no/Templates/Public/Pages/Portal/Login.aspx?epslanguage=en-GB")
In [117]:
driver.find_element_by_css_selector("a[id*=ctl00_PageRegion_LoginControl_btnShowLocalLogin]").click()
In [118]:
elem = driver.find_element_by_name("ctl00$PageRegion$LoginControl$txtUsername")
In [119]:
elem.send_keys("")
In [120]:
elem2 = driver.find_element_by_name("ctl00$PageRegion$LoginControl$txtPassword")
In [121]:
elem2.send_keys("")
In [122]:
driver.find_element_by_css_selector("a[id*=ctl00_PageRegion_LoginControl_btnLocalLogin]").click()
In [123]:
driver.title
Out[123]:
In [124]:
driver.find_element_by_css_selector("a[id*=ctl00_PageRegion_ContentRegion_MainContentRegion_ApplicationListLink]").click()
In [125]:
driver.title
Out[125]:
In [126]:
driver.find_element_by_name("ctl00$PageRegion$ContentRegion$MainContentRegion$ApplicationBox$applicationList$ctrl3$ctl00").click()
In [127]:
driver.title
Out[127]:
In [128]:
time = driver.find_element_by_css_selector("span[id*=ctl00_PageRegion_ContentRegion_MainContentRegion_ViewControl_spnOrgGroupSelector_BookingSummaryInfo_lblTime]").get_attribute('innerHTML')
date = driver.find_element_by_css_selector("span[id*=ctl00_PageRegion_ContentRegion_MainContentRegion_ViewControl_spnOrgGroupSelector_BookingSummaryInfo_lblDate]").get_attribute('innerHTML')
month = date.split("/")[1]
print month
if int(month) < 9: push("Early date: " + date + " at " + time)
else: print month
In [129]:
driver.find_element_by_css_selector("a[id*=ctl00_PageRegion_HeaderRegion_ctl00_ctl00_Logout_LogoutLink]").click()
In [130]:
driver.title
Out[130]:
In [131]:
driver.quit()
In [132]:
import requests
def push(message):
payload = {
"token": "",
"user": "",
"message": message,
"priority": "1"
}
headers = { "Content-type": "application/x-www-form-urlencoded" }
r = requests.post("https://api.pushover.net/1/messages.json", data=payload, headers=headers)
return r.text
In [ ]: