|
|
@@ -2,7 +2,7 @@
|
|
|
title: Automated EPSB check in/out script
|
|
|
author: michael Tang
|
|
|
date created: 2021-01-25
|
|
|
-date modified: 2021-02-01
|
|
|
+date modified: 2021-02-07
|
|
|
'''
|
|
|
import time
|
|
|
from selenium import webdriver
|
|
|
@@ -10,6 +10,10 @@ from selenium import webdriver
|
|
|
global URL
|
|
|
global whoHereFor
|
|
|
|
|
|
+# path to chromedriver
|
|
|
+DRIVER_PATH = "/home/michtang/selenium/chromedriver"
|
|
|
+driver = webdriver.Chrome(DRIVER_PATH)
|
|
|
+
|
|
|
def checkIn():
|
|
|
############### Start of check In #################
|
|
|
textboxes = driver.find_elements_by_class_name("quantumWizTextinputPaperinputInput")
|
|
|
@@ -55,13 +59,13 @@ def checkIn():
|
|
|
print(buttons[1].text)
|
|
|
buttons[1].click()
|
|
|
elif pressSubmit == "n":
|
|
|
- print("done")
|
|
|
+ print("Manual mode")
|
|
|
+ buttons[0].click()
|
|
|
else:
|
|
|
print("invalid key pressed.")
|
|
|
|
|
|
-
|
|
|
-
|
|
|
########################## end of Check in ###########################
|
|
|
+
|
|
|
def checkOut():
|
|
|
############################ start Check Out ############################
|
|
|
textboxes = driver.find_elements_by_class_name("quantumWizTextinputPaperinputInput")
|
|
|
@@ -87,34 +91,32 @@ def locationSelector():
|
|
|
URL = "https://docs.google.com/forms/d/e/1FAIpQLSeJf3A_bADAUyaXuTEfiyU5O4V77PxcL9lYBSC3vgP4Fn4eGg/viewform"
|
|
|
else:
|
|
|
print("not a valid selection.")
|
|
|
+ locationSelector()
|
|
|
+
|
|
|
+def main():
|
|
|
+ locationSelector()
|
|
|
+ # executor_url = driver.command_executor._url
|
|
|
+ # session_id = driver.session_id
|
|
|
+ # print(session_id)
|
|
|
+ driver.get(URL)
|
|
|
+ # time.sleep(2)
|
|
|
+ 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")
|
|
|
+ main()
|
|
|
|
|
|
-
|
|
|
-DRIVER_PATH = "/home/michtang/selenium/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")
|
|
|
+# execute main function
|
|
|
+main()
|