Sunday, December 6, 2020

JNVST automation

Untitled25
In [ ]:
from selenium import webdriver
from selenium.webdriver.support.select import Select
import time
#browser exposes an executable file
#Through Selenium test we will invoke the executable file which will then #invoke actual browser
driver = webdriver.Chrome(executable_path="C:\\chromedriver.exe")
# to maximize the browser window
driver.maximize_window()
#get method to launch the URL
driver.get("https://cbseitms.nic.in/RegistrationFormClass6.aspx")

#driver.find_element_by_xpath("//*[@id="chkread"").click()
driver.find_element_by_xpath("//*[@id='chkread']").click()
driver.find_element_by_xpath("//*[@id='btnproced']").click()
sel = Select(driver.find_element_by_xpath("//*[@id='ddlState']"))
time.sleep(0.8)
#select by select_by_visible_text() method
sel.select_by_visible_text("MADHYA PRADESH")
#district selct
#//*[@id="ddlDistrict"]
time.sleep(0.8)
bel = Select(driver.find_element_by_xpath("//*[@id='ddlDistrict']"))

#select by select_by_visible_text() method
bel.select_by_visible_text("TIKAMGARH")
#block selection
time.sleep(0.9)
blo = Select(driver.find_element_by_xpath("//*[@id='ddlBlock']"))

time.sleep(0.9)
#select by select_by_visible_text() method
blo.select_by_visible_text("BALDEVGARH")

#gender
time.sleep(0.2)
g = Select(driver.find_element_by_xpath("//*[@id='ddlGender']"))

time.sleep(0.2)
#select by select_by_visible_text() method
g.select_by_visible_text("Male")

#Category
time.sleep(0.2)
cat = Select(driver.find_element_by_xpath("//*[@id='ddlCategory']"))

time.sleep(0.2)
#select by select_by_visible_text() method
cat.select_by_visible_text("SC")

#Medium
time.sleep(0.2)
med = Select(driver.find_element_by_xpath("//*[@id='ddlMaritalStatus']"))

time.sleep(0.2)
#select by select_by_visible_text() method
med.select_by_visible_text("Hindi")

#Religion
time.sleep(0.2)
rel= Select(driver.find_element_by_xpath("//*[@id='ddlReligion']"))
time.sleep(0.2)
#select by select_by_visible_text() method
rel.select_by_visible_text("Hinduism")

#ddlResidentialState
time.sleep(0.2)
rs= Select(driver.find_element_by_xpath("//*[@id='ddlResidentialState']"))
time.sleep(0.2)
#select by select_by_visible_text() method
rs.select_by_visible_text("MADHYA PRADESH")


#ddlResidentialDistrict
time.sleep(0.8)
rd= Select(driver.find_element_by_xpath("//*[@id='ddlResidentialDistrict']"))
time.sleep(0.5)
#select by select_by_visible_text() method
rd.select_by_visible_text("TIKAMGARH")

#//*[@id="ddlNameOfState3"]
time.sleep(0.2)
rs3= Select(driver.find_element_by_xpath("//*[@id='ddlNameOfState3']"))
time.sleep(0.2)
#select by select_by_visible_text() method
rs3.select_by_visible_text("MADHYA PRADESH")

#//*[@id="ddlNameOfDistrict3"]
time.sleep(0.8)
rd3= Select(driver.find_element_by_xpath("//*[@id='ddlNameOfDistrict3']"))
time.sleep(0.5)
#select by select_by_visible_text() method
rd3.select_by_visible_text("TIKAMGARH")

#//*[@id="ddlNameOfBlock3"]
time.sleep(0.8)
rB3= Select(driver.find_element_by_xpath("//*[@id='ddlNameOfBlock3']"))
time.sleep(0.5)
#select by select_by_visible_text() method
rB3.select_by_visible_text("BALDEVGARH")

#//*[@id="ddlNameOfState4"]
time.sleep(0.2)
rs4= Select(driver.find_element_by_xpath("//*[@id='ddlNameOfState4']"))
time.sleep(0.2)
#select by select_by_visible_text() method
rs4.select_by_visible_text("MADHYA PRADESH")

#//*[@id="ddlNameOfDistrict4"]
time.sleep(0.8)
rd4= Select(driver.find_element_by_xpath("//*[@id='ddlNameOfDistrict4']"))
time.sleep(0.5)
#select by select_by_visible_text() method
rd4.select_by_visible_text("TIKAMGARH")

#//*[@id="ddlNameOfBlock4"]
time.sleep(0.8)
rB4= Select(driver.find_element_by_xpath("//*[@id='ddlNameOfBlock4']"))
time.sleep(0.5)
#select by select_by_visible_text() method
rB4.select_by_visible_text("BALDEVGARH")

#//*[@id="ddlRecognized3"]
time.sleep(0.1)
sr3= Select(driver.find_element_by_xpath("//*[@id='ddlRecognized3']"))
time.sleep(0.1)
#select by select_by_visible_text() method
sr3.select_by_visible_text("Recognized")

#//*[@id="ddlRecognized4"]
time.sleep(0.1)
sr4= Select(driver.find_element_by_xpath("//*[@id='ddlRecognized4']"))
time.sleep(0.1)
#select by select_by_visible_text() method
sr4.select_by_visible_text("Recognized")

#//*[@id="ddlRecognized5"]
time.sleep(0.1)
sr5= Select(driver.find_element_by_xpath("//*[@id='ddlRecognized5']"))
time.sleep(0.1)
#select by select_by_visible_text() method
sr5.select_by_visible_text("Recognized")

#//*[@id="ddlSchoolLocation3"]
sl3= Select(driver.find_element_by_xpath("//*[@id='ddlSchoolLocation3']"))
time.sleep(0.1)
#select by select_by_visible_text() method
sl3.select_by_visible_text("Rural")

#//*[@id="ddlSchoolLocation4"]
sl4= Select(driver.find_element_by_xpath("//*[@id='ddlSchoolLocation4']"))
time.sleep(0.1)
#select by select_by_visible_text() method
sl4.select_by_visible_text("Rural")

#//*[@id="ddlSchoolLocation5"]
sl5= Select(driver.find_element_by_xpath("//*[@id='ddlSchoolLocation5']"))
time.sleep(0.1)
#select by select_by_visible_text() method
sl5.select_by_visible_text("Rural")

#//*[@id="ddlYearJoining5"]

jy5= Select(driver.find_element_by_xpath("//*[@id='ddlYearJoining5']"))
#select by select_by_visible_text() method
jy5.select_by_visible_text("2020")

#//*[@id="ddlYearJoining4"]

jy4= Select(driver.find_element_by_xpath("//*[@id='ddlYearJoining4']"))
#select by select_by_visible_text() method
jy4.select_by_visible_text("2019")

#//*[@id="ddlYearJoining3"]

jy3= Select(driver.find_element_by_xpath("//*[@id='ddlYearJoining3']"))
#select by select_by_visible_text() method
jy3.select_by_visible_text("2018")

#//*[@id="ddlYearPassing3"]
py3= Select(driver.find_element_by_xpath("//*[@id='ddlYearPassing3']"))
#select by select_by_visible_text() method
py3.select_by_visible_text("2019")

#//*[@id="ddlYearPassing4"]
py4= Select(driver.find_element_by_xpath("//*[@id='ddlYearPassing4']"))
#select by select_by_visible_text() method
py4.select_by_visible_text("2020")

#//*[@id="ddlMonthJoining3"]
mj3= Select(driver.find_element_by_xpath("//*[@id='ddlMonthJoining3']"))
#select by select_by_visible_text() method
mj3.select_by_visible_text("July")

#//*[@id="ddlMonthJoining4"]
mj4= Select(driver.find_element_by_xpath("//*[@id='ddlMonthJoining4']"))
#select by select_by_visible_text() method
mj4.select_by_visible_text("July")

#//*[@id="ddlMonthJoining5"]
mj5= Select(driver.find_element_by_xpath("//*[@id='ddlMonthJoining5']"))
#select by select_by_visible_text() method
mj5.select_by_visible_text("July")

#//*[@id="ddlMonthPassing3"]
mp3= Select(driver.find_element_by_xpath("//*[@id='ddlMonthPassing3']"))
#select by select_by_visible_text() method
mp3.select_by_visible_text("March")

#//*[@id="ddlMonthPassing4"]
mp4= Select(driver.find_element_by_xpath("//*[@id='ddlMonthPassing4']"))
#select by select_by_visible_text() method
mp4.select_by_visible_text("March")

#//*[@id="txtNameOfTheSchool"]

sch= driver.find_element_by_xpath("//*[@id='txtNameOfTheSchool']")
#select by select_by_visible_text() method
sch.send_keys("govt primary school")

#//*[@id="txtNameOfCandidate"]
cnm= driver.find_element_by_xpath("//*[@id='txtNameOfCandidate']")
#select by select_by_visible_text() method
cnm.send_keys("devvrat sharma")

#//*[@id="txtMobileNo"]
mob= driver.find_element_by_xpath("//*[@id='txtMobileNo']")
#select by select_by_visible_text() method
mob.send_keys("9424517700")

#//*[@id="txtDOB"]
#dob= driver.find_element_by_xpath("//*[@id='txtDOB']")
#select by select_by_visible_text() method
#dob.send_keys("01/01/2010")

#//*[@id="txtMotherName"]
dob= driver.find_element_by_xpath("//*[@id='txtDOB']")
#select by select_by_visible_text() method
dob.send_keys("01/01/2010")

#//*[@id="txtMotherName"]
mot= driver.find_element_by_xpath("//*[@id='txtMotherName']")
#select by select_by_visible_text() method
mot.send_keys("vinita sharma")

#//*[@id="txtFatherName"]
fat=driver.find_element_by_xpath("//*[@id='txtFatherName']")
#select by select_by_visible_text() method
fat.send_keys("ravikishore sharma")

#//*[@id="txtNationalityoftheCandidate"]
nat= driver.find_element_by_xpath("//*[@id='txtNationalityoftheCandidate']")
#select by select_by_visible_text() method
nat.send_keys("INDIAN")

#//*[@id="txtIdentificationMark"]
ide= driver.find_element_by_xpath("//*[@id='txtIdentificationMark']")
#select by select_by_visible_text() method
ide.send_keys("mole")

#//*[@id="txtAnnualIncomeofParents"]
inc= driver.find_element_by_xpath("//*[@id='txtAnnualIncomeofParents']")
#select by select_by_visible_text() method
inc.send_keys("80000")

#//*[@id="txtPresentPostalAddress"]
add= driver.find_element_by_xpath("//*[@id='txtPresentPostalAddress']")
#select by select_by_visible_text() method
add.send_keys("village  baldevgarh  tikamgarh")

#//*[@id="txtPincode"]
pin= driver.find_element_by_xpath("//*[@id='txtPincode']")
#select by select_by_visible_text() method
pin.send_keys("472111")

#//*[@id="txtNameOfVillage3"]
vill= driver.find_element_by_xpath("//*[@id='txtNameOfVillage3']")
#select by select_by_visible_text() method
vill.send_keys("vill baldevgarh")

#//*[@id="txtNameOfVillage4"]
vill4= driver.find_element_by_xpath("//*[@id='txtNameOfVillage4']")
#select by select_by_visible_text() method
vill4.send_keys("vill baldevgarh")

#//*[@id="txtNameOfVillage5"]
vill5= driver.find_element_by_xpath("//*[@id='txtNameOfVillage5']")
#select by select_by_visible_text() method
vill5.send_keys("vill baldevgarh")

#//*[@id="txtNameOfSchool3"]
sc3= driver.find_element_by_xpath("//*[@id='txtNameOfSchool3']")
#select by select_by_visible_text() method
sc3.send_keys("govt primary school ")

#//*[@id="txtNameOfSchool4"]
sc4= driver.find_element_by_xpath("//*[@id='txtNameOfSchool4']")
#select by select_by_visible_text() method
sc4.send_keys("govt primary school ")

#//*[@id="txtNameOfSchool5"]
sc5= driver.find_element_by_xpath("//*[@id='txtNameOfSchool5']")
#select by select_by_visible_text() method
sc5.send_keys("govt primary school ")


#//*[@id="FilePhotoUpload"]
ph= driver.find_element_by_xpath("//*[@id='FilePhotoUpload']")
#select by select_by_visible_text() method
ph.send_keys("D:\pic.jpeg")


#//*[@id="FileCandidateSignatureUpload"]
sign= driver.find_element_by_xpath("//*[@id='FileCandidateSignatureUpload']")
#select by select_by_visible_text() method
sign.send_keys("D:\sign.jpeg")

#//*[@id="FileParentSignature"]
signp= driver.find_element_by_xpath("//*[@id='FileParentSignature']")
#select by select_by_visible_text() method
signp.send_keys("D:\psign.jpeg")

#//*[@id="FileCertificate"]
fc= driver.find_element_by_xpath("//*[@id='FileCertificate']")
#select by select_by_visible_text() method
fc.send_keys("D:\cer.jpeg")






#to refresh the browser
#driver.refresh()
#to close the browser
#driver.close()

No comments:

Post a Comment