Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- import unittest
- from selenium import webdriver
- from openpyxl import load_workbook
- from selenium.webdriver.common.by import By
- from selenium.webdriver.common.keys import Keys
- from selenium.webdriver.support import ui, expected_conditions
- from selenium.webdriver.support.wait import WebDriverWait
- filepath = "/home/aj/Desktop/LORIELLE.xlsx"
- wb=load_workbook(filepath)
- sheet=wb.active
- rowCount = sheet.max_row
- browser = webdriver.Chrome("/usr/lib/chromium-browser/chromedriver")
- browser.get('https://ischo.searcaapps.org')
- user = browser.find_element_by_id('username')
- user.send_keys('lavm')
- password = browser.find_element_by_id('password')
- password.send_keys('lavm@1234')
- password.send_keys(Keys.ENTER)
- browser.get('https://ischo.searcaapps.org/ischo/scholarship/?d=all&p=40&fr=2019&to=2021')
- for k in range(40, 61):
- rowNum = len(browser.find_elements_by_xpath('/html/body/section/article/table/tbody/tr'))
- for i in range(1, rowNum):
- currentStatus = browser.find_element_by_xpath("//tr[" + str(i) + "]//td[13]").text
- if currentStatus == 'Alumni':
- currentName = browser.find_element_by_xpath("//tr[" + str(i) + "]//td[2]").text
- print("currentName = " + currentName)
- browser.find_element_by_link_text(currentName).click()
- browser.find_element_by_link_text('Edit').click()
- for j in range(1, rowCount):
- if currentName == sheet.cell(row=j, column=6).value:
- currentRowExcel = j
- # DURATION START
- if sheet.cell(row=currentRowExcel, column=28).value is None:
- browser.find_element_by_id('duration_from').send_keys(
- '06/01' + str(sheet.cell(row=currentRowExcel, column=27).value))
- else:
- start_date = sheet.cell(row=currentRowExcel, column=28).value
- browser.find_element_by_id('duration_from').send_keys(
- str(start_date.strftime('%m')) + str(start_date.strftime('%d')) + str(start_date.year))
- # DURATION END
- if sheet.cell(row=currentRowExcel, column=10).value is None:
- browser.find_element_by_id('duration_to').send_keys(
- '05/31' + str(sheet.cell(row=currentRowExcel, column=11).value))
- else:
- end_date = sheet.cell(row=currentRowExcel, column=10).value
- browser.find_element_by_id('duration_to').send_keys(
- str(end_date.strftime('%m')) + str(end_date.strftime('%d')) + str(end_date.year))
- # DESIRED STUDY
- checkboxes = browser.find_elements_by_name('university')
- for checkbox in checkboxes:
- if checkbox.is_selected(): # If checkbox is ticked
- checkbox.click() # to untick it
- if sheet.cell(row=currentRowExcel, column=16).value.lower() == 'uplb':
- browser.find_element_by_xpath("//input[@id='1']").click()
- elif sheet.cell(row=currentRowExcel, column=16).value.lower() == 'ku':
- browser.find_element_by_xpath("//input[@id='2']").click()
- elif sheet.cell(row=currentRowExcel, column=16).value.lower() == 'upm':
- browser.find_element_by_xpath("//input[@id='3']").click()
- elif sheet.cell(row=currentRowExcel, column=16).value.lower() == 'ipb':
- browser.find_element_by_xpath("//input[@id='4']").click()
- elif sheet.cell(row=currentRowExcel, column=16).value.lower() == 'ugm':
- browser.find_element_by_xpath("//input[@id='5']").click()
- elif sheet.cell(row=currentRowExcel, column=16).value.lower() == 'ub':
- browser.find_element_by_xpath("//input[@id='6']").click()
- else:
- browser.find_element_by_xpath(
- "/html[1]/body[1]/div[1]/form[1]/div[1]/div[5]/div[1]/div[7]/label[1]").click()
- browser.find_element_by_id('home_add').clear()
- browser.find_element_by_id('others').send_keys(sheet.cell(row=currentRowExcel, column=16).value)
- # CLICK NEXT PAGE
- browser.find_element_by_link_text('Next').click()
- time.sleep(2.5)
- # LASTNAME
- if sheet.cell(row=currentRowExcel, column=42).value is None:
- browser.find_element_by_xpath("/html[1]/body[1]/div[1]/form[1]/div[2]/div[1]/div[1]/input[1]").clear()
- browser.find_element_by_xpath("/html[1]/body[1]/div[1]/form[1]/div[2]/div[1]/div[1]/input[1]").send_keys(
- 'N/A')
- else:
- browser.find_element_by_xpath("/html[1]/body[1]/div[1]/form[1]/div[2]/div[1]/div[1]/input[1]").clear()
- browser.find_element_by_xpath("/html[1]/body[1]/div[1]/form[1]/div[2]/div[1]/div[1]/input[1]").send_keys(
- str(sheet.cell(row=currentRowExcel, column=42).value))
- # FIRSTNAME
- if sheet.cell(row=currentRowExcel, column=43).value is None:
- browser.find_element_by_xpath("/html[1]/body[1]/div[1]/form[1]/div[2]/div[1]/div[2]/input[1]").clear()
- browser.find_element_by_xpath("/html[1]/body[1]/div[1]/form[1]/div[2]/div[1]/div[2]/input[1]").send_keys(
- 'N/A')
- else:
- browser.find_element_by_xpath("/html[1]/body[1]/div[1]/form[1]/div[2]/div[1]/div[2]/input[1]").clear()
- browser.find_element_by_xpath("/html[1]/body[1]/div[1]/form[1]/div[2]/div[1]/div[2]/input[1]").send_keys(
- str(sheet.cell(row=currentRowExcel, column=43).value))
- # HOMEADDRESS
- if sheet.cell(row=currentRowExcel, column=44).value is None:
- browser.find_element_by_id('home_add').clear()
- browser.find_element_by_id('home_add').send_keys('N/A')
- else:
- browser.find_element_by_id('home_add').clear()
- browser.find_element_by_id('home_add').send_keys(str(sheet.cell(row=currentRowExcel, column=44).value))
- # HOMETELEPHONE
- if sheet.cell(row=currentRowExcel, column=45).value is None:
- browser.find_element_by_id('home_tel').clear()
- browser.find_element_by_id('home_tel').send_keys('N/A')
- else:
- browser.find_element_by_id('home_tel').clear()
- browser.find_element_by_id('home_tel').send_keys(str(sheet.cell(row=currentRowExcel, column=45).value))
- # HOMEFAX
- if sheet.cell(row=currentRowExcel, column=47).value is None:
- browser.find_element_by_id('home_fax').clear()
- browser.find_element_by_id('home_fax').send_keys('N/A')
- else:
- browser.find_element_by_id('home_fax').clear()
- browser.find_element_by_id('home_fax').send_keys(str(sheet.cell(row=currentRowExcel, column=47).value))
- # E-MAIL
- if sheet.cell(row=currentRowExcel, column=46).value is None:
- browser.find_element_by_id('home_email').clear()
- browser.find_element_by_id('home_email').send_keys('N/A')
- else:
- browser.find_element_by_id('home_email').clear()
- browser.find_element_by_id('home_email').send_keys(str(sheet.cell(row=currentRowExcel, column=46).value))
- # EMPLOYER
- if sheet.cell(row=currentRowExcel, column=21).value is None:
- browser.find_element_by_id('employer').clear()
- browser.find_element_by_id('employer').send_keys('N/A')
- else:
- browser.find_element_by_id('employer').clear()
- browser.find_element_by_id('employer').send_keys(str(sheet.cell(row=currentRowExcel, column=21).value))
- # EMPLOYERADDRESS
- if sheet.cell(row=currentRowExcel, column=22).value is None:
- browser.find_element_by_id('employer_add').clear()
- browser.find_element_by_id('employer_add').send_keys('N/A')
- else:
- browser.find_element_by_id('employer_add').clear()
- browser.find_element_by_id('employer_add').send_keys(str(sheet.cell(row=currentRowExcel, column=22).value))
- # POBOX
- if sheet.cell(row=currentRowExcel, column=23).value is None:
- browser.find_element_by_id('employer_po').clear()
- browser.find_element_by_id('employer_po').send_keys('N/A')
- else:
- browser.find_element_by_id('employer_po').clear()
- browser.find_element_by_id('employer_po').send_keys(str(sheet.cell(row=currentRowExcel, column=23).value))
- # TELNUM
- if sheet.cell(row=currentRowExcel, column=24).value is None:
- browser.find_element_by_id('employer_tel').clear()
- browser.find_element_by_id('employer_tel').send_keys('N/A')
- else:
- browser.find_element_by_id('employer_tel').clear()
- browser.find_element_by_id('employer_tel').send_keys(str(sheet.cell(row=currentRowExcel, column=24).value))
- # FAXNO
- if sheet.cell(row=currentRowExcel, column=25).value is None:
- browser.find_element_by_id('employer_fax').clear()
- browser.find_element_by_id('employer_fax').send_keys('N/A')
- else:
- browser.find_element_by_id('employer_fax').clear()
- browser.find_element_by_id('employer_fax').send_keys(str(sheet.cell(row=currentRowExcel, column=25).value))
- # EMAIL
- if sheet.cell(row=currentRowExcel, column=26).value is None:
- browser.find_element_by_id('employer_email').clear()
- browser.find_element_by_id('employer_email').send_keys('N/A')
- else:
- browser.find_element_by_id('employer_email').clear()
- browser.find_element_by_id('employer_email').send_keys(
- str(sheet.cell(row=currentRowExcel, column=26).value))
- # BIRTHDATE
- birthDate = sheet.cell(row=currentRowExcel, column=40).value
- if birthDate is not None:
- browser.find_element_by_xpath(
- "/html[1]/body[1]/div[1]/form[1]/div[2]/div[3]/div[2]/div[7]/div[1]/input[1]").click()
- browser.find_element_by_xpath(
- "/html[1]/body[1]/div[1]/form[1]/div[2]/div[3]/div[2]/div[7]/div[1]/input[1]").send_keys(
- str(birthDate.strftime('%m')) + str(birthDate.strftime('%d')) + str(birthDate.year))
- else:
- print("birthDate empty")
- # RADIOBUTTONS
- civilStatus = sheet.cell(row=currentRowExcel, column=41).value
- if civilStatus is not None:
- if sheet.cell(row=currentRowExcel, column=41).value.lower() == 'single':
- browser.find_element_by_xpath("//div[11]//div[1]//label[1]").click()
- elif sheet.cell(row=currentRowExcel, column=41).value.lower() == 'married':
- browser.find_element_by_xpath("//div[11]//div[1]//label[2]").click()
- elif sheet.cell(row=currentRowExcel, column=41).value.lower() == 'widower':
- browser.find_element_by_xpath(
- "/html[1]/body[1]/div[1]/form[1]/div[2]/div[3]/div[2]/div[11]/div[1]/label[3]").click()
- else:
- print("civilStatus is empty")
- # PLACEOFBIRTH
- browser.find_element_by_id('birth_place').clear()
- browser.find_element_by_id('birth_place').send_keys('N/A')
- # CONTACTPERSON
- browser.find_element_by_id('contact_name').clear()
- browser.find_element_by_id('contact_name').send_keys('N/A')
- # PASSPORTNUMBER
- browser.find_element_by_id('passport').clear()
- browser.find_element_by_id('passport').send_keys('N/A')
- # PLACEOFISSUE
- browser.find_element_by_id('passport_place').clear()
- browser.find_element_by_id('passport_place').send_keys('N/A')
- # CLICK NEXT PAGE
- browser.find_element_by_link_text('Next').click()
- time.sleep(2.5)
- # NAMEOFCOLLEGE/UNIVERSITY
- browser.find_element_by_xpath("//body/div/form/div[3]/div[1]/div[1]/div[1]/div[1]/div[1]/input[2]").clear()
- browser.find_element_by_xpath(
- "//body/div[@class='container']/form[@class='form-horizontal']/div[@id='third_form']/div[@class='row']/div[@class='col-sm-4 col-md-4']/div[@class='appended-education-div']/div[2]/div[1]/input[1]").clear()
- collegeName = sheet.cell(row=currentRowExcel, column=16).value
- if collegeName is not None:
- if collegeName.lower() == 'uplb':
- browser.find_element_by_xpath(
- "//body/div/form/div[3]/div[1]/div[1]/div[1]/div[1]/div[1]/input[2]").send_keys(
- 'University of the Philippines Los Baños (UPLB)')
- browser.find_element_by_xpath(
- "//body/div[@class='container']/form[@class='form-horizontal']/div[@id='third_form']/div[@class='row']/div[@class='col-sm-4 col-md-4']/div[@class='appended-education-div']/div[2]/div[1]/input[1]").send_keys(
- 'Philippines')
- elif collegeName.lower() == 'ku':
- browser.find_element_by_xpath(
- "//body/div/form/div[3]/div[1]/div[1]/div[1]/div[1]/div[1]/input[2]").send_keys(
- 'Kasetsart University (KU)')
- browser.find_element_by_xpath(
- "//body/div[@class='container']/form[@class='form-horizontal']/div[@id='third_form']/div[@class='row']/div[@class='col-sm-4 col-md-4']/div[@class='appended-education-div']/div[2]/div[1]/input[1]").send_keys(
- 'Thailand')
- elif collegeName.lower() == 'upm':
- browser.find_element_by_xpath(
- "//body/div/form/div[3]/div[1]/div[1]/div[1]/div[1]/div[1]/input[2]").send_keys(
- 'Universiti Putra Malaysia (UPM)')
- browser.find_element_by_xpath(
- "//body/div[@class='container']/form[@class='form-horizontal']/div[@id='third_form']/div[@class='row']/div[@class='col-sm-4 col-md-4']/div[@class='appended-education-div']/div[2]/div[1]/input[1]").send_keys(
- 'Malaysia')
- elif collegeName.lower() == 'ipb':
- browser.find_element_by_xpath(
- "//body/div/form/div[3]/div[1]/div[1]/div[1]/div[1]/div[1]/input[2]").send_keys(
- 'Institut Pertanian Bogor (IPB)')
- browser.find_element_by_xpath(
- "//body/div[@class='container']/form[@class='form-horizontal']/div[@id='third_form']/div[@class='row']/div[@class='col-sm-4 col-md-4']/div[@class='appended-education-div']/div[2]/div[1]/input[1]").send_keys(
- 'Indonesia')
- elif collegeName.lower() == 'ugm':
- browser.find_element_by_xpath(
- "//body/div/form/div[3]/div[1]/div[1]/div[1]/div[1]/div[1]/input[2]").send_keys(
- 'Universitas Gadjah Mada (UGM)')
- browser.find_element_by_xpath(
- "//body/div[@class='container']/form[@class='form-horizontal']/div[@id='third_form']/div[@class='row']/div[@class='col-sm-4 col-md-4']/div[@class='appended-education-div']/div[2]/div[1]/input[1]").send_keys(
- 'Indonesia')
- elif collegeName.lower() == 'ub':
- browser.find_element_by_xpath(
- "//body/div/form/div[3]/div[1]/div[1]/div[1]/div[1]/div[1]/input[2]").send_keys(
- 'Universitas Brawijaya (UB)')
- browser.find_element_by_xpath(
- "//body/div[@class='container']/form[@class='form-horizontal']/div[@id='third_form']/div[@class='row']/div[@class='col-sm-4 col-md-4']/div[@class='appended-education-div']/div[2]/div[1]/input[1]").send_keys(
- 'Indonesia')
- elif collegeName.lower() == 'clsu':
- browser.find_element_by_xpath(
- "//body/div/form/div[3]/div[1]/div[1]/div[1]/div[1]/div[1]/input[2]").send_keys(
- 'Central Luzon State University (CLSU)')
- browser.find_element_by_xpath(
- "//body/div[@class='container']/form[@class='form-horizontal']/div[@id='third_form']/div[@class='row']/div[@class='col-sm-4 col-md-4']/div[@class='appended-education-div']/div[2]/div[1]/input[1]").send_keys(
- 'Philippines')
- elif collegeName.lower() == 'tokyo-nodai':
- browser.find_element_by_xpath(
- "//body/div/form/div[3]/div[1]/div[1]/div[1]/div[1]/div[1]/input[2]").send_keys(
- 'Tokyo-Nodai University')
- browser.find_element_by_xpath(
- "//body/div[@class='container']/form[@class='form-horizontal']/div[@id='third_form']/div[@class='row']/div[@class='col-sm-4 col-md-4']/div[@class='appended-education-div']/div[2]/div[1]/input[1]").send_keys(
- 'Japan')
- elif collegeName.lower() == 'rac':
- browser.find_element_by_xpath(
- "//body/div/form/div[3]/div[1]/div[1]/div[1]/div[1]/div[1]/input[2]").send_keys(
- 'Royal Agricultural University')
- browser.find_element_by_xpath(
- "//body/div[@class='container']/form[@class='form-horizontal']/div[@id='third_form']/div[@class='row']/div[@class='col-sm-4 col-md-4']/div[@class='appended-education-div']/div[2]/div[1]/input[1]").send_keys(
- 'England')
- elif collegeName.lower() == 'asog':
- browser.find_element_by_xpath(
- "//body/div/form/div[3]/div[1]/div[1]/div[1]/div[1]/div[1]/input[2]").send_keys(
- 'Ateneo de Manila University (ADMU)')
- browser.find_element_by_xpath(
- "//body/div[@class='container']/form[@class='form-horizontal']/div[@id='third_form']/div[@class='row']/div[@class='col-sm-4 col-md-4']/div[@class='appended-education-div']/div[2]/div[1]/input[1]").send_keys(
- 'Philippines')
- elif collegeName.lower() == 'upv':
- browser.find_element_by_xpath(
- "//body/div/form/div[3]/div[1]/div[1]/div[1]/div[1]/div[1]/input[2]").send_keys(
- 'University of the Philippines Visayas (UPV)')
- browser.find_element_by_xpath(
- "//body/div[@class='container']/form[@class='form-horizontal']/div[@id='third_form']/div[@class='row']/div[@class='col-sm-4 col-md-4']/div[@class='appended-education-div']/div[2]/div[1]/input[1]").send_keys(
- 'Philippines')
- elif collegeName.lower() == 'unigott':
- browser.find_element_by_xpath(
- "//body/div/form/div[3]/div[1]/div[1]/div[1]/div[1]/div[1]/input[2]").send_keys(
- 'University of Goettingen')
- browser.find_element_by_xpath(
- "//body/div[@class='container']/form[@class='form-horizontal']/div[@id='third_form']/div[@class='row']/div[@class='col-sm-4 col-md-4']/div[@class='appended-education-div']/div[2]/div[1]/input[1]").send_keys(
- 'Germany')
- else:
- pass
- # DURATIONFROM
- start_date = sheet.cell(row=currentRowExcel, column=28).value
- browser.find_element_by_xpath("//div[@id='educfromdate']//input[@placeholder='yyyy']").clear()
- browser.find_element_by_xpath("//div[@id='eductodate']//input[@placeholder='yyyy']").clear()
- if start_date is None:
- browser.find_element_by_xpath("//div[@id='educfromdate']//input[@placeholder='yyyy']").send_keys(
- str(sheet.cell(row=currentRowExcel, column=27).value))
- else:
- browser.find_element_by_xpath("//div[@id='educfromdate']//input[@placeholder='yyyy']").send_keys(
- str(start_date.year))
- # DURATIONTO
- end_date = sheet.cell(row=currentRowExcel, column=10).value
- if end_date is None:
- browser.find_element_by_xpath("//div[@id='eductodate']//input[@placeholder='yyyy']").send_keys(
- str(sheet.cell(row=currentRowExcel, column=11).value))
- else:
- browser.find_element_by_xpath("//div[@id='eductodate']//input[@placeholder='yyyy']").send_keys(
- str(end_date.year))
- # MAJORSUBJECT
- majorSubject = sheet.cell(row=currentRowExcel, column=18).value
- browser.find_element_by_xpath("//body/div/form/div/div/div/div[1]/div[4]/div[1]/input[1]").clear()
- browser.find_element_by_xpath("//body/div/form/div/div/div/div[1]/div[4]/div[1]/input[1]").send_keys(
- str(majorSubject))
- # DIPLOMA/DEGREE
- browser.find_element_by_xpath("//body/div/form/div/div/div/div[1]/div[5]/div[1]/input[1]").clear()
- browser.find_element_by_xpath("//body/div/form/div/div/div/div[1]/div[5]/div[1]/input[1]").send_keys(
- str(majorSubject))
- # MASTERSDEGREE and #BACHELORSDEGREE
- masters_university = sheet.cell(row=currentRowExcel, column=54).value
- bachelors_university = sheet.cell(row=currentRowExcel, column=49).value
- masters_country = sheet.cell(row=currentRowExcel, column=55).value
- bachelors_country = sheet.cell(row=currentRowExcel, column=52).value
- masters_from = sheet.cell(row=currentRowExcel, column=57).value
- masters_to = sheet.cell(row=currentRowExcel, column=56).value
- bachelors_from = sheet.cell(row=currentRowExcel, column=50).value
- bachelors_to = sheet.cell(row=currentRowExcel, column=51).value
- masters_major = sheet.cell(row=currentRowExcel, column=53).value
- bachelors_major = sheet.cell(row=currentRowExcel, column=48).value
- if masters_university and bachelors_university is not None:
- browser.find_element_by_xpath("//a[@class='btn btn-default add-education']").click()
- browser.find_element_by_xpath("//a[@class='btn btn-default add-education']").click()
- # MASTERSUNIVERSITY and BACHELORSUNIVERSITY
- browser.find_element_by_xpath("//div//div//div//div//div[2]//div[1]//div[1]//div[1]//input[2]").clear()
- browser.find_element_by_xpath(
- "//div//div//div//div//div[2]//div[1]//div[1]//div[1]//input[2]").send_keys(str(masters_university))
- browser.find_element_by_xpath("//div//div//div//div//div//div[2]//div[1]//div[1]//input[2]").clear()
- browser.find_element_by_xpath("//div//div//div//div//div//div[2]//div[1]//div[1]//input[2]").send_keys(
- str(bachelors_university))
- # MASTERSCOUNTRY and BACHELORSCOUNTRY
- browser.find_element_by_xpath("//div[@id='collegediv']//div[1]//div[2]//div[1]//input[1]").clear()
- browser.find_element_by_xpath("//div[@id='collegediv']//div[1]//div[2]//div[1]//input[1]").send_keys(
- str(masters_country))
- browser.find_element_by_xpath("//div[@id='collegediv']//div[2]//div[2]//div[1]//input[1]").clear()
- browser.find_element_by_xpath("//div[@id='collegediv']//div[2]//div[2]//div[1]//input[1]").send_keys(
- str(bachelors_country))
- # MASTERSFROM and BACHELORSFROM
- browser.find_element_by_xpath(
- "//div[@id='collegediv']//div[1]//div[3]//div[1]//div[1]//input[1]").clear()
- browser.find_element_by_xpath(
- "//div[@id='collegediv']//div[1]//div[3]//div[1]//div[1]//input[1]").send_keys(str(masters_from))
- browser.find_element_by_xpath(
- "//div[@id='collegediv']//div[2]//div[3]//div[1]//div[1]//input[1]").clear()
- browser.find_element_by_xpath(
- "//div[@id='collegediv']//div[2]//div[3]//div[1]//div[1]//input[1]").send_keys(str(bachelors_from))
- # MASTERSTO and BACHELORSTO
- browser.find_element_by_xpath(
- "/html[1]/body[1]/div[1]/form[1]/div[3]/div[1]/div[1]/div[2]/div[1]/div[3]/div[1]/div[2]/input[1]").clear()
- browser.find_element_by_xpath(
- "/html[1]/body[1]/div[1]/form[1]/div[3]/div[1]/div[1]/div[2]/div[1]/div[3]/div[1]/div[2]/input[1]").send_keys(
- str(masters_to))
- # MASTERSMAJOR and BACHELORSMAJOR
- browser.find_element_by_xpath("//form//div//div//div//div//div[1]//div[4]//div[1]//input[1]").clear()
- browser.find_element_by_xpath("//form//div//div//div//div//div[1]//div[5]//div[1]//input[1]").clear()
- browser.find_element_by_xpath("//div//div//div//div//div//div[2]//div[4]//div[1]//input[1]").clear()
- browser.find_element_by_xpath("//div//div//div//div//div//div[2]//div[5]//div[1]//input[1]").clear()
- browser.find_element_by_xpath("//form//div//div//div//div//div[1]//div[4]//div[1]//input[1]").send_keys(
- str(masters_major))
- browser.find_element_by_xpath("//form//div//div//div//div//div[1]//div[5]//div[1]//input[1]").send_keys(
- str(masters_major))
- browser.find_element_by_xpath("//div//div//div//div//div//div[2]//div[4]//div[1]//input[1]").send_keys(
- str(bachelors_major))
- browser.find_element_by_xpath("//div//div//div//div//div//div[2]//div[5]//div[1]//input[1]").send_keys(
- str(bachelors_major))
- elif masters_university is not None and bachelors_university is None:
- browser.find_element_by_xpath("//a[@class='btn btn-default add-education']").click()
- # UNIV
- browser.find_element_by_xpath("//div//div//div//div//div[2]//div[1]//div[1]//div[1]//input[2]").clear()
- browser.find_element_by_xpath(
- "//div//div//div//div//div[2]//div[1]//div[1]//div[1]//input[2]").send_keys(str(masters_university))
- # COUNTRY
- browser.find_element_by_xpath("//div[@id='collegediv']//div[1]//div[2]//div[1]//input[1]").clear()
- browser.find_element_by_xpath("//div[@id='collegediv']//div[1]//div[2]//div[1]//input[1]").send_keys(
- str(masters_country))
- # FROM
- browser.find_element_by_xpath(
- "//div[@id='collegediv']//div[1]//div[3]//div[1]//div[1]//input[1]").clear()
- browser.find_element_by_xpath(
- "//div[@id='collegediv']//div[1]//div[3]//div[1]//div[1]//input[1]").send_keys(str(masters_from))
- # TO
- browser.find_element_by_xpath("//div[@id='todate']//input[@placeholder='yyyy']").clear()
- browser.find_element_by_xpath("//div[@id='todate']//input[@placeholder='yyyy']").send_keys(
- str(masters_to))
- # DEGREE
- browser.find_element_by_xpath("//form//div//div//div//div//div[1]//div[4]//div[1]//input[1]").clear()
- browser.find_element_by_xpath("//form//div//div//div//div//div[1]//div[5]//div[1]//input[1]").clear()
- browser.find_element_by_xpath("//form//div//div//div//div//div[1]//div[4]//div[1]//input[1]").send_keys(
- str(masters_major))
- browser.find_element_by_xpath("//form//div//div//div//div//div[1]//div[5]//div[1]//input[1]").send_keys(
- str(masters_major))
- elif masters_university is None and bachelors_university is not None:
- browser.find_element_by_xpath("//a[@class='btn btn-default add-education']").click()
- # UNIV
- browser.find_element_by_xpath("//div//div//div//div//div[2]//div[1]//div[1]//div[1]//input[2]").clear()
- browser.find_element_by_xpath(
- "//div//div//div//div//div[2]//div[1]//div[1]//div[1]//input[2]").send_keys(
- str(bachelors_university))
- # COUNTRY
- browser.find_element_by_xpath("//div[@id='collegediv']//div[1]//div[2]//div[1]//input[1]").clear()
- browser.find_element_by_xpath("//div[@id='collegediv']//div[1]//div[2]//div[1]//input[1]").send_keys(
- str(bachelors_country))
- # FROM
- browser.find_element_by_xpath(
- "//div[@id='collegediv']//div[1]//div[3]//div[1]//div[1]//input[1]").clear()
- browser.find_element_by_xpath(
- "//div[@id='collegediv']//div[1]//div[3]//div[1]//div[1]//input[1]").send_keys(str(bachelors_from))
- # TO
- browser.find_element_by_xpath("//div[@id='todate']//input[@placeholder='yyyy']").clear()
- browser.find_element_by_xpath("//div[@id='todate']//input[@placeholder='yyyy']").send_keys(
- str(bachelors_to))
- # DEGREE
- browser.find_element_by_xpath("//form//div//div//div//div//div[1]//div[4]//div[1]//input[1]").clear()
- browser.find_element_by_xpath("//form//div//div//div//div//div//div[5]//div[1]//input[1]").clear()
- browser.find_element_by_xpath("//form//div//div//div//div//div[1]//div[4]//div[1]//input[1]").send_keys(
- str(bachelors_major))
- browser.find_element_by_xpath("//form//div//div//div//div//div//div[5]//div[1]//input[1]").send_keys(
- str(bachelors_major))
- else:
- pass
- # EMPLOYMENT
- # CURRENTEMPLOYMENT
- current_position = sheet.cell(row=currentRowExcel, column=9).value
- current_company = sheet.cell(row=currentRowExcel, column=21).value
- # CURRENT POSITION
- browser.find_element_by_xpath(
- "/html[1]/body[1]/div[1]/form[1]/div[3]/div[1]/div[2]/div[1]/div[1]/div[1]/input[2]").clear()
- if current_position is not None:
- browser.find_element_by_xpath(
- "/html[1]/body[1]/div[1]/form[1]/div[3]/div[1]/div[2]/div[1]/div[1]/div[1]/input[2]").send_keys(
- str(current_position))
- else:
- browser.find_element_by_xpath(
- "/html[1]/body[1]/div[1]/form[1]/div[3]/div[1]/div[2]/div[1]/div[1]/div[1]/input[2]").send_keys(
- str('N/A'))
- # CURRENTCOMPANY
- browser.find_element_by_xpath(
- "/html[1]/body[1]/div[1]/form[1]/div[3]/div[1]/div[2]/div[1]/div[2]/div[1]/input[1]").clear()
- if current_company is not None:
- browser.find_element_by_xpath(
- "/html[1]/body[1]/div[1]/form[1]/div[3]/div[1]/div[2]/div[1]/div[2]/div[1]/input[1]").send_keys(
- str(current_company))
- else:
- browser.find_element_by_xpath(
- "/html[1]/body[1]/div[1]/form[1]/div[3]/div[1]/div[2]/div[1]/div[2]/div[1]/input[1]").send_keys(
- str('N/A'))
- # FROMTO - CURRENT
- browser.find_element_by_xpath(
- "/html[1]/body[1]/div[1]/form[1]/div[3]/div[1]/div[2]/div[1]/div[3]/div[1]/div[1]/input[1]").clear()
- browser.find_element_by_xpath(
- "/html[1]/body[1]/div[1]/form[1]/div[3]/div[1]/div[2]/div[1]/div[3]/div[1]/div[2]/input[1]").clear()
- browser.find_element_by_xpath(
- "/html[1]/body[1]/div[1]/form[1]/div[3]/div[1]/div[2]/div[1]/div[3]/div[1]/div[1]/input[1]").send_keys(
- str('2019'))
- browser.find_element_by_xpath(
- "/html[1]/body[1]/div[1]/form[1]/div[3]/div[1]/div[2]/div[1]/div[3]/div[1]/div[2]/input[1]").send_keys(
- str('2019'))
- # OLDEMPLOYMENT
- old_position = sheet.cell(row=currentRowExcel, column=32).value
- old_company = sheet.cell(row=currentRowExcel, column=33).value
- if browser.find_elements_by_xpath(
- "//div[@id='employmentdiv']//div[@class='appended-employment-div']").__len__() == 1:
- # OLDPOSITION
- if old_position is not None:
- browser.find_element_by_xpath(
- "/html[1]/body[1]/div[1]/form[1]/div[3]/div[1]/div[2]/div[2]/div[1]/div[2]/div[1]/input[1]").clear()
- browser.find_element_by_xpath(
- "/html[1]/body[1]/div[1]/form[1]/div[3]/div[1]/div[2]/div[2]/div[1]/div[2]/div[1]/input[1]").send_keys(
- str(old_position))
- else:
- browser.find_element_by_xpath(
- "/html[1]/body[1]/div[1]/form[1]/div[3]/div[1]/div[2]/div[2]/div[1]/div[2]/div[1]/input[1]").clear()
- browser.find_element_by_xpath(
- "/html[1]/body[1]/div[1]/form[1]/div[3]/div[1]/div[2]/div[2]/div[1]/div[2]/div[1]/input[1]").send_keys(
- str('N/A'))
- # OLDCOMPANY
- if old_position is not None:
- if old_company is not None:
- browser.find_element_by_xpath(
- "//form//div//div//div//div[2]//div[1]//div[2]//div[1]//input[1]").clear()
- browser.find_element_by_xpath(
- "//form//div//div//div//div[2]//div[1]//div[2]//div[1]//input[1]").send_keys(
- str(old_company))
- else:
- if current_company is None:
- browser.find_element_by_xpath(
- "//form//div//div//div//div[2]//div[1]//div[2]//div[1]//input[1]").clear()
- browser.find_element_by_xpath(
- "//form//div//div//div//div[2]//div[1]//div[2]//div[1]//input[1]").send_keys(str('N/A'))
- else:
- browser.find_element_by_xpath(
- "//form//div//div//div//div[2]//div[1]//div[2]//div[1]//input[1]").send_keys(
- str(current_company))
- else:
- browser.find_element_by_xpath(
- "//form//div//div//div//div[2]//div[1]//div[2]//div[1]//input[1]").clear()
- browser.find_element_by_xpath(
- "//form//div//div//div//div[2]//div[1]//div[2]//div[1]//input[1]").send_keys(str('N/A'))
- # FROM-TO
- browser.find_element_by_xpath(
- "/html[1]/body[1]/div[1]/form[1]/div[3]/div[1]/div[2]/div[1]/div[3]/div[1]/div[1]/input[1]").clear()
- browser.find_element_by_xpath(
- "/html[1]/body[1]/div[1]/form[1]/div[3]/div[1]/div[2]/div[1]/div[3]/div[1]/div[1]/input[1]").send_keys(
- str('2019'))
- browser.find_element_by_xpath(
- "/html[1]/body[1]/div[1]/form[1]/div[3]/div[1]/div[2]/div[1]/div[3]/div[1]/div[2]/input[1]").clear()
- browser.find_element_by_xpath(
- "/html[1]/body[1]/div[1]/form[1]/div[3]/div[1]/div[2]/div[1]/div[3]/div[1]/div[2]/input[1]").send_keys(
- str('2019'))
- else:
- # OLDPOSITION
- if old_position is not None:
- browser.find_element_by_xpath("//a[@class='btn btn-default add-work']").click()
- browser.find_element_by_xpath(
- "/html[1]/body[1]/div[1]/form[1]/div[3]/div[1]/div[2]/div[2]/div[1]/div[2]/div[1]/input[1]").clear()
- browser.find_element_by_xpath(
- "/html[1]/body[1]/div[1]/form[1]/div[3]/div[1]/div[2]/div[2]/div[1]/div[2]/div[1]/input[1]").send_keys(
- str(old_position))
- # OLDCOMPANY
- if old_company is not None:
- browser.find_element_by_xpath(
- "//form//div//div//div//div[2]//div[1]//div[2]//div[1]//input[1]").clear()
- browser.find_element_by_xpath(
- "//form//div//div//div//div[2]//div[1]//div[2]//div[1]//input[1]").send_keys(
- str(old_company))
- else:
- if current_company is None:
- browser.find_element_by_xpath(
- "//form//div//div//div//div[2]//div[1]//div[2]//div[1]//input[1]").clear()
- browser.find_element_by_xpath(
- "//form//div//div//div//div[2]//div[1]//div[2]//div[1]//input[1]").send_keys(str('N/A'))
- else:
- browser.find_element_by_xpath(
- "//form//div//div//div//div[2]//div[1]//div[2]//div[1]//input[1]").clear()
- browser.find_element_by_xpath(
- "//form//div//div//div//div[2]//div[1]//div[2]//div[1]//input[1]").send_keys(
- str(current_company))
- browser.find_element_by_xpath(
- "/html[1]/body[1]/div[1]/form[1]/div[3]/div[1]/div[2]/div[1]/div[3]/div[1]/div[1]/input[1]").clear()
- browser.find_element_by_xpath(
- "/html[1]/body[1]/div[1]/form[1]/div[3]/div[1]/div[2]/div[1]/div[3]/div[1]/div[1]/input[1]").send_keys(
- str('2019'))
- browser.find_element_by_xpath(
- "/html[1]/body[1]/div[1]/form[1]/div[3]/div[1]/div[2]/div[1]/div[3]/div[1]/div[2]/input[1]").clear()
- browser.find_element_by_xpath(
- "/html[1]/body[1]/div[1]/form[1]/div[3]/div[1]/div[2]/div[1]/div[3]/div[1]/div[2]/input[1]").send_keys(
- str('2019'))
- else:
- pass
- # DESCRIPTIONOFMOSTRECENTJOB
- browser.find_element_by_id('job_desc').clear()
- if sheet.cell(row=currentRowExcel, column=20).value is not None:
- browser.find_element_by_id('job_desc').send_keys(
- str('works at the ' + (sheet.cell(row=currentRowExcel, column=20).value)))
- else:
- browser.find_element_by_id('job_desc').send_keys(str('N/A'))
- # DESCRIPTIONOFMAJORAREAOFINTEREST
- browser.find_element_by_id('area_interest').clear()
- if sheet.cell(row=currentRowExcel, column=59).value is not None:
- browser.find_element_by_id('area_interest').send_keys(
- str(sheet.cell(row=currentRowExcel, column=59).value))
- else:
- pass
- # RESEARCHCARRIEDOUT
- browser.find_element_by_name('research[]').clear()
- if sheet.cell(row=currentRowExcel, column=35).value is not None:
- browser.find_element_by_name('research[]').send_keys(
- str(sheet.cell(row=currentRowExcel, column=35).value))
- else:
- pass
- browser.find_element_by_link_text('Next').click()
- time.sleep(2.5)
- browser.get('https://ischo.searcaapps.org/ischo/scholarship/?d=all&p=' + str(k) + '&fr=2019&to=2021')
- time.sleep(2.5)
- else:
- print(str(i) + ' not alumni')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement