''' title: Automated EPSB check in/out script author: michael Tang date created: 2021-01-25 date modified: 2021-02-01 ''' import time from selenium import webdriver global URL global whoHereFor def checkIn(): ############### Start of check In ################# textboxes = driver.find_elements_by_class_name("quantumWizTextinputPaperinputInput") textboxes[0].send_keys("Michael Tang") checkInRadio = driver.find_element_by_css_selector("#i9") checkInRadio.click() nextButton = driver.find_element_by_class_name("quantumWizButtonPaperbuttonLabel") nextButton.click() time.sleep(2) # check In # get textboxes textboxes2 = driver.find_elements_by_class_name("quantumWizTextinputPaperinputInput") # get radio buttons radiobuttons = driver.find_elements_by_class_name("docssharedWizToggleLabeledLabelWrapper") # get submit button buttons = driver.find_elements_by_class_name("quantumWizButtonPaperbuttonLabel") # email [0] textboxes2[0].send_keys("michael.tang@epsb.ca") # org [1] textboxes2[1].send_keys("EPS Supply Services") # phone number [2] textboxes2[2].send_keys("7809656618") # who will you be working with [3] textboxes2[3].send_keys(whoHereFor) # click no radio radiobuttons[0].click() # click next buttons[1].click() ########################## end of Check in ########################### def checkOut(): ############################ start Check Out ############################ textboxes = driver.find_elements_by_class_name("quantumWizTextinputPaperinputInput") textboxes[0].send_keys("Michael Tang") checkOutRadio = driver.find_element_by_css_selector("#i12") checkOutRadio.click() nextButton = driver.find_element_by_css_selector(".quantumWizButtonPaperbuttonLabel") nextButton.click() time.sleep(3) # wait for next page to load # Next page of check Out whoWereYouHereFor = driver.find_element_by_css_selector(".exportTextarea") whoWereYouHereFor.send_keys(whoHereFor) ############################ end Check Out ############################## def locationSelector(): print("Select the school: ") print("1. ABM") schoolSelected = input("Select the school: ") if schoolSelected == "1": global URL URL = "https://docs.google.com/forms/d/e/1FAIpQLSeJf3A_bADAUyaXuTEfiyU5O4V77PxcL9lYBSC3vgP4Fn4eGg/viewform" else: print("not a valid selection.") DRIVER_PATH = "/Users/michaeltang/.wdm/drivers/chromedriver/88.0.4324.96/mac64/chromedriver" # URL = input("Enter the URL: ") locationSelector() driver = webdriver.Chrome(DRIVER_PATH) executor_url = driver.command_executor._url session_id = driver.session_id print(session_id) driver.get(URL) time.sleep(3) print("Enter what you want to do: ") print("1: check in") print("2. check out") checkInOut = input("Your selection: ") # print(checkInOut) if checkInOut == "1": print("running check in") global whoHereFor whoHereFor = input("Who are you in for: ") checkIn() elif checkInOut == "2": print("running check out") whoHereFor = input("Who were you in for: ") checkOut() else: print("you did not enter a valid option")