-
Notifications
You must be signed in to change notification settings - Fork 0
/
attendance_driver.py
70 lines (53 loc) · 2.89 KB
/
attendance_driver.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import time
from variables import *
chrome_options = Options()
if(run_headless!='no'):
chrome_options.add_argument('--headless')
chrome_options.add_argument('--log-level=3')
web=webdriver.Chrome("./chromedriver.exe", options=chrome_options)
def mark_attendance(participant_name, participant_reg_no):
web.get(google_form_link)
time.sleep(1)
form_email=web.find_element_by_xpath('//*[@id="mG61Hd"]/div[2]/div/div[2]/div[1]/div/div[1]/div[2]/div[1]/div/div[1]/input')
form_email.send_keys(club_email)
club_or_chapter_dropdown=web.find_element_by_xpath('//*[@id="mG61Hd"]/div[2]/div/div[2]/div[2]/div/div/div[2]/div/div[1]/div[1]/div[1]')
club_or_chapter_dropdown.click()
time.sleep(0.8)
club_or_chapter_option = web.find_elements_by_xpath("//div//span[contains(., "+"'"+club_or_chapter+"'"+")]")
for i in club_or_chapter_option:
try:
i.click()
except Exception as e:
print(e)
club_or_chapter_name_dropdown=web.find_element_by_xpath('//*[@id="mG61Hd"]/div[2]/div/div[2]/div[3]/div/div/div[2]/div/div[1]/div[1]/div[1]')
club_or_chapter_name_dropdown.click()
time.sleep(0.8)
club_or_chapter_name_option = web.find_elements_by_xpath("//div//span[contains(., "+"'"+club_or_chapter_name+"'"+")]")
for i in club_or_chapter_name_option:
try:
i.click()
except Exception as e:
print(e)
time.sleep(0.8)
page_one_submit=web.find_element_by_xpath('//*[@id="mG61Hd"]/div[2]/div/div[3]/div[1]/div[1]/div/span/span')
page_one_submit.click()
time.sleep(0.8)
form_event_name=web.find_element_by_xpath('//*[@id="mG61Hd"]/div[2]/div/div[2]/div[3]/div/div/div[2]/div/div[1]/div/div[1]/input')
form_event_name.send_keys(event_name)
form_event_date=web.find_element_by_xpath('//*[@id="mG61Hd"]/div[2]/div/div[2]/div[4]/div/div/div[2]/div/div/div[2]/div[1]/div/div[1]/input')
form_event_date.send_keys(event_date)
page_two_submit=web.find_element_by_xpath('//*[@id="mG61Hd"]/div[2]/div/div[3]/div[1]/div[1]/div[2]/span/span')
page_two_submit.click()
time.sleep(0.8)
form_participant_name=web.find_element_by_xpath('//*[@id="mG61Hd"]/div[2]/div/div[2]/div[3]/div/div/div[2]/div/div[1]/div/div[1]/input')
form_participant_name.send_keys(participant_name)
form_participant_registration_number=web.find_element_by_xpath('//*[@id="mG61Hd"]/div[2]/div/div[2]/div[4]/div/div/div[2]/div/div[1]/div/div[1]/input')
form_participant_registration_number.send_keys(participant_reg_no)
final_submit_button=web.find_element_by_xpath('//*[@id="mG61Hd"]/div[2]/div/div[3]/div[1]/div/div[2]/span/span')
final_submit_button.click()
time.sleep(0.8)
submit_message=web.find_element_by_css_selector('.freebirdFormviewerViewResponseConfirmationMessage')
if(submit_message.text=="Your response has been recorded."):
print("Attendance marked for", participant_name)