Check High School Result using Selenium in Python
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:
- First to go high school website .
- Then click on investigate element by urgent ctrl + shift + i or stepping into setting of browser and clicking on investigate detail manually.
- Then navigate to the box where the roll number is filled then copy the x_path.
- Then navigate the submit button then copy the x_path.
- 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
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
filename = "result.csv"
f = open (filename, 'w' )
header = "name,status\n"
f.write(header)
start_roll_no = 477593
end_roll_no = 477599
for i in range (start_roll_no, end_roll_no + 1 ):
try :
driver = webdriver.Chrome()
tv = '0' + str (i)
driver.find_element_by_xpath( "/html/body/center/table/tbody/tr[2]/td/form/p[1]/input" ).send_keys(t)
driver.find_element_by_xpath( "/html/body/center/table/tbody/tr[2]/td/form/p[2]/input[1]" ).click()
name = driver.find_element_by_xpath( '/html/body/center/table[2]/tbody/tr[2]/td[2]/p/b/font' ).text
status = driver.find_element_by_xpath( '/html/body/center/table[3]/tbody/tr[5]/td[6]/b/font' ).text
f.write(name + "," + status + "\n" )
driver.close()
except NoSuchElementException as exception:
continue
f.close()
|
Output:
Last Updated :
20 Mar, 2024
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...