-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgoogleAutomation.py
325 lines (321 loc) · 17.7 KB
/
googleAutomation.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
from selenium import webdriver
import xlrd
def main():
driver = webdriver.Chrome()
# put your complete google form link down here
driver.get('https://docs.google.com/forms/d/e/1FAIpQLScVP6ZjYUfvVCoz0ID_jrbI2fPXn0jxvPLvXiODG_bDboLutQ/viewform')
# data import from col 1
firstname=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[3]/div/div[2]/div/div[1]/div/div[1]/input').send_keys(firstlist)
# data import from col 2
lastname=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[4]/div/div[2]/div/div[1]/div/div[1]/input').send_keys(lastlist)
# data import from col 3
dob=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[5]/div/div[2]/div/div[2]/div[1]/div/div[1]/input').send_keys(doblist)
# chooose item from drop down
def engchoose():
engoption=driver.find_element_by_xpath('//div[@role="presentation"]')
engoption.click()
driver.implicitly_wait(10)
eng1=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[6]/div/div[2]/div[2]/div[3]')
eng2 = driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[6]/div/div[2]/div[2]/div[4]')
eng3 = driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[6]/div/div[2]/div[2]/div[5]')
eng4 = driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[6]/div/div[2]/div[2]/div[6]')
eng5 = driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[6]/div/div[2]/div[2]/div[7]')
eng6 = driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[6]/div/div[2]/div[2]/div[8]')
eng7 = driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[6]/div/div[2]/div[2]/div[9]')
eng8 = driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[6]/div/div[2]/div[2]/div[10]')
eng9 = driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[6]/div/div[2]/div[2]/div[11]')
eng10 = driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[6]/div/div[2]/div[2]/div[12]')
e=[eng1,eng2,eng3,eng4,eng5,eng6,eng7,eng8,eng9,eng10]
for i in e:
if (englishlist == 1):
eng1.click()
break
if (englishlist == 2):
eng2.click()
break
if (englishlist == 3):
eng3.click()
break
if (englishlist == 4):
eng4.click()
break
if (englishlist == 5):
eng5.click()
break
if (englishlist == 6):
eng6.click()
break
if (englishlist == 7):
eng7.click()
break
if (englishlist == 8):
eng8.click()
break
if (englishlist == 9):
eng9.click()
break
if (englishlist == 10):
eng10.click()
break
engchoose()
driver.implicitly_wait(10)
school=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[7]/div/div[2]/div/div[1]/div/div[1]/input').send_keys(schoollist)
def classnum():
cls1=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[8]/div/div[2]/div/div[1]/div/div[2]/span/div[2]')
cls2 = driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[8]/div/div[2]/div/div[1]/div/div[2]/span/div[3]')
cls3 = driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[8]/div/div[2]/div/div[1]/div/div[2]/span/div[4]')
cls4 = driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[8]/div/div[2]/div/div[1]/div/div[2]/span/div[5]')
cls5 = driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[8]/div/div[2]/div/div[1]/div/div[2]/span/div[6]')
cls6 = driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[8]/div/div[2]/div/div[1]/div/div[2]/span/div[7]')
cls7 = driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[8]/div/div[2]/div/div[1]/div/div[2]/span/div[8]')
cls8 = driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[8]/div/div[2]/div/div[1]/div/div[2]/span/div[9]')
cls9 = driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[8]/div/div[2]/div/div[1]/div/div[2]/span/div[10]')
cls10 = driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[8]/div/div[2]/div/div[1]/div/div[2]/span/div[11]')
cls11 = driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[8]/div/div[2]/div/div[1]/div/div[2]/span/div[12]')
cls12 = driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[8]/div/div[2]/div/div[1]/div/div[2]/span/div[13]')
c=[cls1,cls2,cls3,cls4,cls5,cls6,cls7,cls8,cls9,cls10,cls11,cls12]
for i in c:
if (classlist == 1):
cls1.click()
break
if (classlist == 2):
cls2.click()
break
if (classlist == 3):
cls3.click()
break
if (classlist == 4):
cls4.click()
break
if (classlist == 5):
cls5.click()
break
if (classlist == 6):
cls6.click()
break
if (classlist == 7):
cls7.click()
break
if (classlist == 8):
cls8.click()
break
if (classlist == 9):
cls9.click()
break
if (classlist == 10):
cls10.click()
break
if (classlist == 11):
cls11.click()
break
if (classlist == 12):
cls12.click()
break
classnum()
def coursenum():
course=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[9]/div/div[2]/div[1]')
course.click()
driver.implicitly_wait(10)
crs1=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[9]/div/div[2]/div[2]/div[3]')
crs2=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[9]/div/div[2]/div[2]/div[4]')
crs3=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[9]/div/div[2]/div[2]/div[5]')
crs4=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[9]/div/div[2]/div[2]/div[6]')
crs5=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[9]/div/div[2]/div[2]/div[7]')
crs6=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[9]/div/div[2]/div[2]/div[8]')
crs7=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[9]/div/div[2]/div[2]/div[9]')
crs8=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[9]/div/div[2]/div[2]/div[10]')
crs9=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[9]/div/div[2]/div[2]/div[11]')
crs10=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[9]/div/div[2]/div[2]/div[12]')
crs11=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[9]/div/div[2]/div[2]/div[13]')
crs12=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[9]/div/div[2]/div[2]/div[14]')
crs13=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[9]/div/div[2]/div[2]/div[15]')
crs14=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[9]/div/div[2]/div[2]/div[16]')
crs15=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[9]/div/div[2]/div[2]/div[17]')
crs16=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[9]/div/div[2]/div[2]/div[18]')
crs17=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[9]/div/div[2]/div[2]/div[19]')
crs18=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[9]/div/div[2]/div[2]/div[20]')
crs19=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[9]/div/div[2]/div[2]/div[21]')
crs20=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[9]/div/div[2]/div[2]/div[22]')
crs21=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[9]/div/div[2]/div[2]/div[23]')
crs22=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[9]/div/div[2]/div[2]/div[24]')
crs23=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[9]/div/div[2]/div[2]/div[25]')
crs24=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[9]/div/div[2]/div[2]/div[26]')
crs25=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[9]/div/div[2]/div[2]/div[27]')
crs26=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[9]/div/div[2]/div[2]/div[28]')
crs27=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[9]/div/div[2]/div[2]/div[29]')
crs28=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[9]/div/div[2]/div[2]/div[30]')
crs29=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[9]/div/div[2]/div[2]/div[31]')
crs30=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[9]/div/div[2]/div[2]/div[32]')
crs31=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[9]/div/div[2]/div[2]/div[33]')
crs32=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[9]/div/div[2]/div[2]/div[34]')
crs33=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[9]/div/div[2]/div[2]/div[35]')
crs34=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[9]/div/div[2]/div[2]/div[36]')
crs35=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[9]/div/div[2]/div[2]/div[37]')
crs36=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[9]/div/div[2]/div[2]/div[38]')
crs37=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[9]/div/div[2]/div[2]/div[39]')
crl = [crs1,crs2,crs3,crs4,crs5,crs6,crs7,crs8,crs9,crs10,crs11,crs12,crs13,crs14,crs15,crs16,crs17,crs18,crs19,crs20,crs21,crs22,crs23,crs24,crs25,crs26,crs27,crs28,crs29,crs30,crs31,crs32,crs33,crs34,crs35,crs36,crs37]
for i in crl:
if (courselist == 'Bank of America Student Leaders'):
crs1.click()
break
if (courselist == 'Boston University – Research in Science & Engineering (RISE)'):
crs2.click()
break
if (courselist == 'Canada/USA Mathcamp'):
crs3.click()
break
if (courselist == 'Carnegie Mellon – Summer Academy for Math + Science (SAMS)'):
crs4.click()
break
if (courselist == 'Cronkite Institute for High School Journalism: Summer Journalism Institute'):
crs5.click()
break
if (courselist == 'Foundation for Teaching Economics – Economics for Leaders (EFL)'):
crs6.click()
break
if (courselist == 'Garcia Scholars – Stony Brook University'):
crs7.click()
break
if (courselist == 'Girls Who Code Summer Immersion Camp'):
crs8.click()
break
if (courselist == 'Hampshire College Summer Studies in Mathematics (HCSSIM)'):
crs9.click()
break
if (courselist == 'Indiana University – Young Women’s Institute'):
crs10.click()
break
if (courselist == 'Jackson Laboratory – Summer Student Program'):
crs11.click()
break
if (courselist == 'JCamp - For Journalism students'):
crs12.click()
break
if (courselist == 'LaunchX'):
crs13.click()
break
if (courselist == 'Massachusetts Institute of Technology – Minority Introduction to Science and Engineering (MITES)'):
crs14.click()
break
if (courselist == 'MathILy – Bryn Mawr College'):
crs15.click()
break
if (courselist == 'MDI Biological Laboratory Summer Research Fellowship'):
crs16.click()
break
if (courselist == 'Michigan Math and Science Scholars'):
crs17.click()
break
if (courselist == 'Michigan State University – High School Honors Science, Math and Engineering Program (HSHSP)'):
crs18.click()
break
if (courselist == 'MIT Research Science Institute'):
crs19.click()
break
if (courselist == 'Monell Center Science Apprenticeship Program'):
crs20.click()
break
if (courselist == 'National Institutes of Health – Summer Internship in Biomedical Research (SIP)'):
crs21.click()
break
if (courselist == 'Ohio State University – Ross Mathematics Program'):
crs22.click()
break
if (courselist == 'Princeton University – Summer Journalism Program'):
crs23.click()
break
if (courselist == 'Program in Mathematics for Young Scientists (PROMYS)'):
crs24.click()
break
if (courselist == 'Simons Summer Research Program'):
crs25.click()
break
if (courselist == 'Stanford Institutes of Medicine Summer Research Program (SIMR)'):
crs26.click()
break
if (courselist == 'Stanford University Mathematics Camp (SUMaC)'):
crs27.click()
break
if (courselist == 'Telluride Association Summer Program (TASP)'):
crs28.click()
break
if (courselist == 'Texas Tech University – Clark Scholar'):
crs29.click()
break
if (courselist == 'U.S. Air Force Academy – Summer Seminar'):
crs30.click()
break
if (courselist == 'U.S. Coast Guard Academy – Academy Introduction Mission (AIM)'):
crs31.click()
break
if (courselist == 'U.S. Military Academy – Summer Leaders Experience'):
crs32.click()
break
if (courselist == 'U.S. Naval Academy – Summer Seminar'):
crs33.click()
break
if (courselist == 'University of Iowa – Secondary Student Training Program (SSTP)'):
crs34.click()
break
if (courselist == 'University of Notre Dame – Leadership Seminars'):
crs35.click()
break
if (courselist == 'University of Pennsylvania – Leadership in the Business World'):
crs36.click()
break
if (courselist == 'Yale Young Global Scholars'):
crs37.click()
break
coursenum()
email=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[11]/div/div[2]/div/div[1]/div/div[1]/input').send_keys(emaillist)
phone=driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[12]/div/div[2]/div/div[1]/div/div[1]/input').send_keys(phonelist)
def choosefed():
fed = driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[13]/div/div[2]/div[1]/div[1]/div[1]')
fed.click()
driver.implicitly_wait(10)
frd1 = driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[13]/div/div[2]/div[2]/div[3]')
frd2 = driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[13]/div/div[2]/div[2]/div[4]')
frd3 = driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[13]/div/div[2]/div[2]/div[5]')
frd4 = driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[13]/div/div[2]/div[2]/div[6]')
frd5 = driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[13]/div/div[2]/div[2]/div[7]')
frd6 = driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[13]/div/div[2]/div[2]/div[8]')
f=[frd1,frd2,frd3,frd4,frd5,frd6]
for i in f:
if (feedbacklist=='Friends/ Word of mouth'):
frd1.click()
break
if (feedbacklist == 'Social Media'):
frd2.click()
break
if (feedbacklist == 'International School Advisor'):
frd3.click()
break
if (feedbacklist == 'Other website/ Google'):
frd4.click()
break
if (feedbacklist == 'Flyer/ Poster'):
frd5.click()
break
if (feedbacklist == 'other'):
frd6.click()
break
choosefed()
workbook = xlrd.open_workbook("svap2020dh-2-march.xlsx")
sheet = workbook.sheet_by_name("SVAP2020dh-march")
rowcount = sheet.nrows
colcount = sheet.ncols
print(rowcount)
print(colcount)
for i in range(2,6):
firstlist = sheet.cell_value(i, 0)
print(firstlist)
lastlist = sheet.cell_value(i, 1)
doblist = sheet.cell_value(i, 2)
englishlist=sheet.cell_value(i, 3) #for english level
schoollist=sheet.cell_value(i, 4)
classlist=sheet.cell_value(i, 5) #for class standard
courselist=sheet.cell_value(i, 6)
emaillist=sheet.cell_value(i, 7)
phonelist=sheet.cell_value(i, 8)
feedbacklist=sheet.cell_value(i, 9) #for feedback
main()