Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions PageLogin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
from getpass import getpass
import no_graph_features as ngf
from course_details import tabulate_course_details
from selenium.webdriver.firefox.service import Service
from webdriver_manager.firefox import GeckoDriverManager
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.common.by import By

options = Options()
options.headless = True

# Specify Path to geckodriver for Firefox
driver = webdriver.Firefox(options=options, executable_path=r"./geckodriver-v0.26.0-linux64/geckodriver")
driver = webdriver.Firefox(options=options, service=Service(executable_path=GeckoDriverManager().install()))

# Navigating to the webpage
driver.get("https://www.iitm.ac.in/viewgrades/")
Expand All @@ -19,22 +21,22 @@

# Loop prompting correct login details
tried = False
while driver.current_url=="https://www.iitm.ac.in/viewgrades/index.html" or driver.current_url=="https://www.iitm.ac.in/viewgrades/":
while driver.current_url=="https://www.iitm.ac.in/viewgrades/index.html" or driver.current_url=="https://www.iitm.ac.in/viewgrades/":

if tried == True:
# Check if it is not the first iteration
print("Incorrect Roll Number and/or Password")

# Locate form fields
rollno = driver.find_element_by_name("rollno")
pwd = driver.find_element_by_name("pwd")
rollno = driver.find_element(By.NAME, "rollno")
pwd = driver.find_element(By.NAME, "pwd")

roll = input("Enter your roll number:")
password = getpass("Enter your password:")

rollno.send_keys(roll)
pwd.send_keys(password)
driver.find_element_by_name("submit").click()
driver.find_element(By.NAME, "submit").click()

tried = True

Expand All @@ -44,10 +46,10 @@


# Intro greeting
name = driver.find_element_by_xpath("/html/body/center/table/tbody/tr/th[3]")
name = driver.find_element(By.XPATH, "/html/body/center/table/tbody/tr/th[3]")
print("Hi,", name.text)

cg = driver.find_element_by_xpath("/html/body/center/center/table[1]/tbody/tr[last()]/td[last()]")
cg = driver.find_element(By.XPATH, "/html/body/center/center/table[1]/tbody/tr[last()]/td[last()]")
print("Your", cg.text)

courses, sem = tabulate_course_details(driver)
Expand All @@ -59,13 +61,11 @@
choice = input('''\nHow do you want you visualize your grades:
a) GPA for courses taken in a specific department

Other features will come soon.
Other features will come soon.

Enter x to exit
''')
if choice.lower() == 'a':
dept, gpa = ngf.Dept_GPA(courses)
print("Your GPA of the courses done in", dept, "department is", gpa, "\n")
dummy = input('''Press Enter to continue''')


9 changes: 6 additions & 3 deletions course_details.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
from selenium.webdriver.common.by import By

def tabulate_course_details(driver):
'''
driver: Webdriver element

returns: Course and Semester details in a tabular format
'''
courses = driver.find_element_by_xpath("/html/body/center/center/table[1]/tbody").text
courses = driver.find_element(By.XPATH, "/html/body/center/center/table[1]/tbody").text
course_list = courses.split('\n')

#print(course_list)

course_list = [i.split() for i in course_list]

count = 0
course_code = []
course_name = []
course_category = []
Expand All @@ -32,12 +35,12 @@ def tabulate_course_details(driver):
credits.append((int(i[1][-2:]), count))
else:
credits.append((int(i[1][-1]), count))

else:
count = 0
sem.append(' '.join(i[:]))

course_summary = (course_code, course_name, course_category, course_credits, course_grade)
sem_summary = (sem, credits)

return course_summary, sem_summary
return course_summary, sem_summary
Binary file added geckodriver-v0.31.0-linux64/geckodriver
Binary file not shown.
4 changes: 2 additions & 2 deletions no_graph_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def Dept_GPA(courses):
'''
while True:
dept = input("Enter the department code: ")
total_credits = 0
total_credits = 0
total_points = 0
for i in range(len(courses[0])):
if courses[0][i][:2] == dept:
Expand All @@ -19,4 +19,4 @@ def Dept_GPA(courses):
pass
gpa = round(total_points/total_credits, 2)

return dept, gpa
return dept, gpa