forked from risi1006/Ranklist-NITH
-
Notifications
You must be signed in to change notification settings - Fork 1
/
nith.py
121 lines (89 loc) · 2.48 KB
/
nith.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
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import os
import openpyxl
from openpyxl import Workbook
browser = webdriver.Chrome('C:\\Users\\DELL\\Downloads\\chromedriver')
def search(roll_no,a,b):
browser.get('http://59.144.74.15/scheme17/studentresult/index.asp')
elem = browser.find_element_by_name('RollNumber')
elem.send_keys(roll_no)
elem.send_keys(Keys.ENTER)
data = browser.find_elements_by_xpath("/html/body/div[1]/table/tbody/tr[1]/td[2]/div")
cgpi = browser.find_elements_by_xpath("/html/body/div[7]/table/tbody/tr[2]/td[3]")
sgpi = browser.find_elements_by_xpath("/html/body/div[7]/table/tbody/tr[2]/td[1]")
print(data[0].text, end=" ")
print(cgpi[0].text)
l=cgpi[0].text
if '.' in l:
k = l.index('.')
no = l[k - 1:k + 4]
else:
no = (l[7:12])
l2 = sgpi[0].text
if '.' in l2:
k2 = l2.index('.')
no2 = l2[k2 - 1:k2 + 4]
else:
no2 = (l2[7:12])
fname = 'Ranklist.xlsx'
if(os.path.exists(fname)):
workbook = openpyxl.load_workbook(fname)
worksheet = workbook.get_sheet_by_name('Sheet')
else:
workbook = Workbook()
worksheet = workbook.active
worksheet.cell(row=a, column=b).value = data[0].text
worksheet.cell(row=a, column=b + 1).value = (no)
worksheet.cell(row=a, column=b + 2).value = (no2)
workbook.save(fname)
def electrical():
b = 17201 # starting roll no of this branch
c = 17294 # Last roll no of this branch
p = 2
q = 1
for i in range(b, c):
search(i, p, q)
p += 1
# added for cse branch
def CSE():
b = 17501 # starting roll no of this branch
c = 17595 # Last roll no of this branch
p = 2
q = 1
for i in range(b, c):
search(i, p, q)
p += 1
def cse_dd():
a = "17mi"
b = 501
c = 561
p = 2
q = 1
for i in range(b, c):
s = a + str(i)
p += 1
if i==529 or i==532 or i==545 or i==560 or i==546 or i==555:
continue
else:
search(s, p, q)
def cse_iiit():
url='http://59.144.74.15/iiituna17/studentresult/index.asp'
a = "iiitu17"
b = 101
c = 158
p = 2
q = 1
for i in range(b, c):
s = a + str(i)
search(s, p, q)
p += 1
a=int(input("IIIT Cse - 1 "
"Electrical - 2 "
"CSE Dual - 3 "))
if a == 1:
cse_iiit()
elif a == 2:
electrical()
elif a == 3:
cse_dd()