Open In App

Check High School Result using Selenium in Python

Improve
Improve
Like Article
Like
Save
Share
Report

We are going to study check high school result status pass or fail by using selenium. This is very useful for schools because when they check how many student pass-fail and what is the name of a fail student. If the student amount is 10 and less than 10 then check easily by manual when if the number of students is 400 to 1000 then check the status by manual is very hard and time taking process then we are doing smart work check for the result. Using selenium check result and store in a CSV file.

We are going to check the status of the results in high school by using selenium. This might be very helpful for school authorities by helping them in organizing data on the basis of the pass and fail status. They can get the number of passes and fail students followed by their names. Manual checking of status is preferable only when the number of students is less, like around 10 or 20. But for numerous students, it is not recommendable and convenient to perform manual checking as it takes more time and work.

Here, We came up with a solution by automating this process using selenium. We can perform smart checking of result status and store the data in CSV file

Requirement:

You need to install chrome driver and set path. Click here To download. For more information follow this link

Below are the steps:

  1. First to go high school website .
  2. Then click on investigate element by urgent ctrl + shift + i or stepping into setting of browser and clicking on investigate detail manually.
  3. Then navigate to the box where the roll number is filled then copy the x_path.
  4. Then navigate the submit button then copy the x_path.
  5. I want to store the result in CSV file then also navigate student name and status. Then fill up roll number automatically by script go to next page find x_path of name and status.

Follow step-by-step with the help of screenshots and copy the x_path of element and put into the code:

Step 1:

Step 2:

Step 3:

Step 4:

Step 5:

Step 6:

Step 7:

Step 8:

Step 9:

Below is the implementation:

Python3




# import required libraries
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
import csv 
import time
  
# give name of csv file
filename = "result.csv"
   
# open file in write mode
f = open(filename, 'w')
  
# create header
header = "name,status\n"
  
# write into the file
f.write(header)
  
# put rollnumber without zero like
# your number 0477593 then
# put 477593 upto XXXXX.
start_roll_no = 477593
end_roll_no = 477599
  
for i in range(start_roll_no, end_roll_no + 1):
      
    # exception handling
    try:
        # create instance of Chrome webdriver
        driver = webdriver.Chrome()
  
        # paste the link upboard website
        driver.get("https://upresults.nic.in/HighSchoolResult.aspx")
          
        # roll number start with zero then change into string
        tv= '0'+str(i)
          
        # find the element where we have to
        # enter the xpath target rollnumber box 
        # and put rollnumber value who store in t. 
        driver.find_element_by_xpath("/html/body/center/table/tbody/tr[2]/td/form/p[1]/input").send_keys(t)
          
        # paste the xpath of submit button 
        driver.find_element_by_xpath("/html/body/center/table/tbody/tr[2]/td/form/p[2]/input[1]").click()
  
        # name of student's x_path copy and get text of element
        name=driver.find_element_by_xpath('/html/body/center/table[2]/tbody/tr[2]/td[2]/p/b/font').text
          
        # result of student's x_path copy and get text of element
        status=driver.find_element_by_xpath('/html/body/center/table[3]/tbody/tr[5]/td[6]/b/font').text
          
        # write in the file
        f.write(name + "," + status + "\n")
          
        # close the web driver
        driver.close()
          
    # using exception when rollnumber is wrong and
    # not show result on this roll number
    except NoSuchElementException as exception:
        continue
  
# close and save the file
f.close()


Output:

Output csv file



Last Updated : 20 Mar, 2024
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads