def enterLogin(isEmpl): if isEmpl: navTo( 'https://weblogin.umich.edu/?cosign-hcmprod.dsc&https://hcmprod.dsc.umich.edu/services/employee/' ) else: navTo( 'https://weblogin.umich.edu/?cosign-csprod.dsc&https://csprod.dsc.umich.edu/services/student/' ) if "Weblogin" in driver.title: try: usr = getpass('Enter username: '******'Enter password: '******'login', usr) enterTextId('password', password) pressEnterId('password') except: print("Oops, something went wrong...") wait = WebDriverWait(driver, 60) try: wait.until(EC.presence_of_element_located((By.ID, 'PT_HOME'))) except: driver.quit()
from cookies import readCookies, writeCookies from webdriver import driver from helpers import handleLogin, quitSess from pages import Home, Student, StudentCenter, EmployeeSelfService from helpers import navTo #cookies = pickle.load(open("cookies.pkl", "rb")) readCookies() # Home() # print(driver.title) # # Student() # navTo('https://csprod.dsc.umich.edu/services/student') # print(driver.title) # # StudentCenter() # StudentCenter() # print(driver.title) # #assert "No results found." not in driver.page_source #quitSess() driver.quit()
def quitSess(): writeCookies() driver.close() driver.quit() exit()
def waitTitle(str): wait = WebDriverWait(driver, 60) try: wait.until(not EC.title_is(str)) finally: driver.quit()
def waitId(id): wait = WebDriverWait(driver, 60) try: wait.until(EC.presence_of_element_located((By.ID, id))) finally: driver.quit()