-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathfbot.py
237 lines (226 loc) · 10.7 KB
/
fbot.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
from selenium import webdriver
from time import sleep
from secrets import *
class fbot():
def __init__(self):
#open web browser (chrome)
self.driver = webdriver.Chrome()
def feedback (self):
#open feedback form link
self.driver.get(link)
sleep(2)
#click on sign in button
signin_btn = self.driver.find_element_by_xpath('/html/body/div[2]/div/div[2]/div[3]/div[2]/span/span')
signin_btn.click()
sleep(2)
#send signin data
email_id = self.driver.find_element_by_xpath('//*[@id="identifierId"]')
email_id.send_keys(email)
#click on next button
sleep(2)
next_btn1 = self.driver.find_element_by_xpath('//*[@id="identifierNext"]')
next_btn1.click()
#enter Password
sleep(2)
passwd_field = self.driver.find_element_by_xpath('//*[@id="password"]/div[1]/div/div[1]/input')
passwd_field.send_keys(passwd)
#click on next button
next_btn2 = self.driver.find_element_by_xpath('//*[@id="passwordNext"]')
next_btn2.click()
sleep(5)
#PAGE 1
#fill form email id
sleep(2)
form_email = self.driver.find_element_by_xpath(
'//*[@id="mG61Hd"]/div/div/div[2]/div[1]/div[2]/div/div[1]/div/div[1]/input')
form_email.send_keys(email)
#Click on university name
uni_name = self.driver.find_element_by_xpath(
'//*[@id="mG61Hd"]/div/div/div[2]/div[2]/div/div[2]/div/span/div/div/label/div/div[1]/div/div[3]/div')
uni_name.click()
#fill Student Name
std_name = self.driver.find_element_by_xpath(
'//*[@id="mG61Hd"]/div/div/div[2]/div[3]/div/div[2]/div/div[1]/div/div[1]/input')
std_name.send_keys(name)
#fill urn field
urn_field = self.driver.find_element_by_xpath(
'//*[@id="mG61Hd"]/div/div/div[2]/div[4]/div/div[2]/div/div[1]/div/div[1]/input')
urn_field.send_keys(urn)
#click on course Button
sleep(2)
course_btn = self.driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[5]/div/div[2]/div/span/div/div/label/div/div[1]/div/div[3]/div')
course_btn.click()
#click on semester button
sem_btn = self.driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[6]/div/div[2]/div/span/div/div/label/div/div[1]/div/div[3]/div')
sem_btn.click()
#click on subject name
sub_name = self.driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[7]/div/div[2]/div/span/div/div/label/div/div[1]/div/div[3]/div')
sub_name.click()
#click on faculty name
fac_name = self.driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[8]/div/div[2]/div/span/div/div/label/div/div[1]/div/div[3]/div')
fac_name.click()
#click on Q1
rb1 = self.driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[9]/div/div[2]/div/span/div/div[5]/label/div/div[1]/div/div[3]/div')
rb1.click()
a=10
choice=5 #NOTE - change the value of 5 to adjust score to be given in each question
#Note You cannot change the score to be given individually
while True:
try:
rb2 = self.driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div['+str(a)+']/div/div[2]/div/span/div/div['+str(choice)+']/label/div/div[1]/div/div[3]/div')
rb2.click()
a+=1
except Exception:
cmnt_box = self.driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[27]/div/div[2]/div/div[1]/div/div[1]/input')
cmnt_box.send_keys(cmnt1)
break
next_btn3 = self.driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[3]/div[1]/div/div')
next_btn3.click()
sleep(5)
#PAGE 2
sleep(2)
rb3 = self.driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[3]/div/div[2]/div/span/div/div/label/div/div[1]/div/div[3]/div')
rb3.click()
rb4 = self.driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[4]/div/div[2]/div/span/div/div/label/div/div[1]/div/div[3]/div')
rb4.click()
#start clicking on radio buttons
b=5
while True:
try:
rb5 = self.driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div['+str(b)+']/div/div[2]/div/span/div/div['+str(choice)+']/label/div/div[1]/div/div[3]/div')
rb5.click()
b+=1
except Exception:
cmnt_box2 = self.driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[23]/div/div[2]/div/div[1]/div/div[1]/input')
cmnt_box2.send_keys(cmnt2)
break
next_btn4 = self.driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[3]/div[1]/div/div[2]')
next_btn4.click()
sleep(5)
#PAGE 3
sleep(2)
rb6 = self.driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[3]/div/div[2]/div/span/div/div/label/div/div[1]/div/div[3]/div')
rb6.click()
rb7 = self.driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[4]/div/div[2]/div/span/div/div/label/div/div[1]/div/div[3]/div')
rb7.click()
#start clicking on radio buttons
sleep(2)
c=5
while True:
try:
rb8 = self.driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div['+str(c)+']/div/div[2]/div/span/div/div['+str(choice)+']/label/div/div[1]/div')
rb8.click()
c+=1
except Exception:
cmnt_box3 = self.driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[2]/div[23]/div/div[2]/div/div[1]/div/div[1]/input')
cmnt_box3.send_keys(cmnt3)
break
next_btn4 = self.driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[3]/div[1]/div/div[2]')
next_btn4.click()
sleep(2)
#PAGE 4
sleep(2)
rb6 = self.driver.find_element_by_xpath(
'//*[@id="mG61Hd"]/div/div/div[2]/div[3]/div/div[2]/div/span/div/div/label/div/div[1]/div/div[3]/div')
rb6.click()
rb7 = self.driver.find_element_by_xpath(
'//*[@id="mG61Hd"]/div/div/div[2]/div[4]/div/div[2]/div/span/div/div/label/div/div[1]/div/div[3]/div')
rb7.click()
# start clicking on radio buttons
sleep(2)
c = 5
while True:
try:
rb8 = self.driver.find_element_by_xpath(
'//*[@id="mG61Hd"]/div/div/div[2]/div[' + str(c) + ']/div/div[2]/div/span/div/div[' + str(
choice) + ']/label/div/div[1]/div')
rb8.click()
c += 1
except Exception:
cmnt_box3 = self.driver.find_element_by_xpath(
'//*[@id="mG61Hd"]/div/div/div[2]/div[23]/div/div[2]/div/div[1]/div/div[1]/input')
cmnt_box3.send_keys(cmnt4)
break
next_btn4 = self.driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[3]/div[1]/div/div[2]')
next_btn4.click()
sleep(2)
#PAGE 5
sleep(2)
rb6 = self.driver.find_element_by_xpath(
'//*[@id="mG61Hd"]/div/div/div[2]/div[3]/div/div[2]/div/span/div/div/label/div/div[1]/div/div[3]/div')
rb6.click()
rb7 = self.driver.find_element_by_xpath(
'//*[@id="mG61Hd"]/div/div/div[2]/div[4]/div/div[2]/div/span/div/div/label/div/div[1]/div/div[3]/div')
rb7.click()
# start clicking on radio buttons
sleep(2)
c = 5
while True:
try:
rb8 = self.driver.find_element_by_xpath(
'//*[@id="mG61Hd"]/div/div/div[2]/div[' + str(c) + ']/div/div[2]/div/span/div/div[' + str(
choice) + ']/label/div/div[1]/div')
rb8.click()
c += 1
except Exception:
cmnt_box3 = self.driver.find_element_by_xpath(
'//*[@id="mG61Hd"]/div/div/div[2]/div[23]/div/div[2]/div/div[1]/div/div[1]/input')
cmnt_box3.send_keys(cmnt5)
break
next_btn4 = self.driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[3]/div[1]/div/div[2]')
next_btn4.click()
sleep(2)
#PAGE 6
sleep(2)
rb6 = self.driver.find_element_by_xpath(
'//*[@id="mG61Hd"]/div/div/div[2]/div[3]/div/div[2]/div/span/div/div/label/div/div[1]/div/div[3]/div')
rb6.click()
rb7 = self.driver.find_element_by_xpath(
'//*[@id="mG61Hd"]/div/div/div[2]/div[4]/div/div[2]/div/span/div/div/label/div/div[1]/div/div[3]/div')
rb7.click()
# start clicking on radio buttons
sleep(2)
c = 5
while True:
try:
rb8 = self.driver.find_element_by_xpath(
'//*[@id="mG61Hd"]/div/div/div[2]/div[' + str(c) + ']/div/div[2]/div/span/div/div[' + str(
choice) + ']/label/div/div[1]/div')
rb8.click()
c += 1
except Exception:
cmnt_box3 = self.driver.find_element_by_xpath(
'//*[@id="mG61Hd"]/div/div/div[2]/div[23]/div/div[2]/div/div[1]/div/div[1]/input')
cmnt_box3.send_keys(cmnt6)
break
next_btn4 = self.driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[3]/div[1]/div/div[2]')
next_btn4.click()
sleep(2)
#PAGE 7
sleep(2)
rb6 = self.driver.find_element_by_xpath(
'//*[@id="mG61Hd"]/div/div/div[2]/div[3]/div/div[2]/div/span/div/div/label/div/div[1]/div/div[3]/div')
rb6.click()
rb7 = self.driver.find_element_by_xpath(
'//*[@id="mG61Hd"]/div/div/div[2]/div[4]/div/div[2]/div/span/div/div/label/div/div[1]/div/div[3]/div')
rb7.click()
# start clicking on radio buttons
sleep(2)
c = 5
while True:
try:
rb8 = self.driver.find_element_by_xpath(
'//*[@id="mG61Hd"]/div/div/div[2]/div[' + str(c) + ']/div/div[2]/div/span/div/div[' + str(
choice) + ']/label/div/div[1]/div')
rb8.click()
c += 1
except Exception:
cmnt_box3 = self.driver.find_element_by_xpath(
'//*[@id="mG61Hd"]/div/div/div[2]/div[23]/div/div[2]/div/div[1]/div/div[1]/input')
cmnt_box3.send_keys(cmnt7)
break
next_btn4 = self.driver.find_element_by_xpath('//*[@id="mG61Hd"]/div/div/div[3]/div[1]/div/div[2]')
next_btn4.click()
sleep(2)
bot = fbot()
bot.feedback()