Created
November 30, 2016 17:45
-
-
Save nelsontkq/d0935f1a6c3481d7f91bead2bc067e9a to your computer and use it in GitHub Desktop.
Wipro
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.5.2 (C:\Program Files\Python35\python.exe)" project-jdk-type="Python SDK" /> | |
</project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="ProjectModuleManager"> | |
<modules> | |
<module fileurl="file://$PROJECT_DIR$/.idea/Wipro.iml" filepath="$PROJECT_DIR$/.idea/Wipro.iml" /> | |
</modules> | |
</component> | |
</project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<module type="PYTHON_MODULE" version="4"> | |
<component name="NewModuleRootManager"> | |
<content url="file://$MODULE_DIR$" /> | |
<orderEntry type="jdk" jdkName="Python 3.5.2 (C:\Program Files\Python35\python.exe)" jdkType="Python SDK" /> | |
<orderEntry type="sourceFolder" forTests="false" /> | |
</component> | |
<component name="TestRunnerService"> | |
<option name="PROJECT_TEST_RUNNER" value="Unittests" /> | |
</component> | |
</module> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Parses any date format into the ahk format | |
DateParse(str) { | |
static e2 := """i)(?:(\d{1,2}+)[\s\.\-\/,]+)?(\d{1,2}|(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\w*)[\s\.\-\/,]+(\d{2,4})""" | |
str: = RegExReplace(str, "((?:".SubStr(e2, 42, 47). | |
")\w*)(\s*)(\d{1,2})\b", "$3$2$1", "", 1) | |
If | |
RegExMatch(str, "i)^\s*(?:(\d{4})([\s\-:\/])(\d{1,2})\2(\d{1,2}))?" | |
. | |
"(?:\s*[T\s](\d{1,2})([\s\-:\/])(\d{1,2})(?:\6(\d{1,2})\s*(?:(Z)|(\+|\-)?" | |
. | |
"(\d{1,2})\6(\d{1,2})(?:\6(\d{1,2}))?)?)?)?\s*$", i) | |
d3: = i1, d2:= i3, d1: = i4, t1:= i5, t2: = i7, t3:= i8 | |
Else | |
If !RegExMatch(str, "^\W*(\d{1,2}+)(\d{2})\W*$", t) | |
RegExMatch(str, "i)(\d{1,2})\s*:\s*(\d{1,2})(?:\s*(\d{1,2}))?(?:\s*([ap]m))?", t) | |
, RegExMatch(str, e2, d) | |
f = % A_FormatFloat % | |
SetFormat, Float, 02.0 | |
d: = (d3 ? (StrLen(d3) = 2 ? 20: "").d3: A_YYYY) | |
.((d2: = d2 + 0 ? d2: (InStr(e2, SubStr(d2, 1, 3)) - 40) // 4 + 1.0) > 0 | |
? d2 + 0.0: A_MM).((d1 += 0.0) ? d1: A_DD).t1 | |
+ (t1 = 12 ? t4 = "am" ? -12.0: 0.0: t4 = "am" ? 0.0: 12.0).t2 + 0.0.t3 + 0.0 | |
SetFormat, Float, % f % | |
Return, d | |
} | |
def errorhandling( message ): | |
"Sends an error message to the appropriate location." | |
FormatTime, time,, yyyy - MM - dd | |
HH: mm:ss | |
FileAppend, Error | |
message: % message % `ntime: % time % `n, error.dump | |
MsgBox, Error: `n % message % `nExiting | |
Application | |
return | |
PasswordGenerate() | |
{ | |
length: = "8" | |
possible: = "abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ234567890@*#$`%" | |
StringLen, max, possible | |
Loop | |
{ | |
Random, rand, 1, max | |
StringMid, char, possible, rand, 1 | |
IfNotInString, password, % char % | |
{ | |
password: = password.char | |
if StrLen(password) >= length | |
break | |
} | |
} | |
return password | |
} | |
# formats | |
their | |
broken | |
english | |
input | |
to | |
ours | |
Reformat(theirFormat, removeChars) | |
{ | |
AutoTrim, on | |
theirFormat = % theirFormat % | |
# shared | |
if (theirFormat = "To Duration") | |
return "DateTo" | |
if (theirFormat = "From Duration") | |
return "DateFrom" | |
if (RegExMatch(theirFormat, | |
"([0-9]{2}-[A-Za-z]{3}-[0-9]{4}|[0-9]{2}-[0-9]{2}-[0-9]{4})")) # if it's a date in their stupid formats | |
{ | |
RegExMatch(theirFormat, "([0-9]{2}-[A-Za-z]{3}-[0-9]{4}|[0-9]{2}-[0-9]{2}-[0-9]{4})", match) | |
longDate: = DateParse(match) | |
FormatTime, formattedDate, % longDate %, yyyy - MM - dd | |
hh: mm:ss | |
return % formattedDate % | |
} | |
if (theirFormat = "UK National Insurance Number") | |
return "NationalInsuranceNumber" | |
if (theirFormat = "United Kingdom") | |
return "United Kingdom - England" | |
if (theirFormat = "Town/City") | |
return "Town" | |
if (theirFormat = "Post Code") | |
return "PostCode" | |
# person | |
if (theirFormat = "First Name") | |
return "Forename" | |
if (theirFormat = "Middle Name") | |
return "MiddleName" | |
if (theirFormat = "Town/City and Country of Birth") | |
return "CityCountryOfBirth" | |
if (theirFormat = "Most Appropriate Telephone Number") | |
return "HomeTel" | |
if (theirFormat = "Mother Maiden Name") | |
return "MotherMaidenName" | |
if (theirFormat = "Email Address") | |
return "PersonalEmail" | |
if (theirFormat = "Date of Birth") | |
return "DateOfBirth" | |
# addresses | |
if (theirFormat = "Address Line 1") | |
return "AddressLine1" | |
if (theirFormat = "Address Type") | |
return "AddressType" | |
if (theirFormat = "CurrAddr") | |
return "Current Address" | |
if (theirFormat = "PrevAddr") | |
return "Previous Address" | |
# education | |
if (theirFormat = "School/College/University") | |
return "InstitutionName" | |
# educationqualification | |
if (theirFormat = "Course Title") | |
returnStr: = "Subject" | |
if (theirFormat = "Qualification Title") | |
return "Award" | |
# employment | |
if (theirFormat = "Employer/Company Name") | |
return "CompanyName" | |
if (theirFormat = "Address")# full address line | |
return "AddressLine1"# | |
can | |
't think of a clean way to split this as it is user input | |
if (theirFormat = "Job Title") | |
return "PositionHeld" | |
if (theirFormat = "HR Contact Name") | |
return "HRContact" | |
# else remove | |
invalid | |
chars | |
if (removeChars) | |
{ | |
return RegExReplace(theirFormat, "[^a-zA-Z0-9`-_`.,]") | |
} | |
else | |
{ | |
return % theirFormat % | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[INFO - 2016-11-30T09:56:41.844Z] GhostDriver - Main - running on port 50669 | |
[INFO - 2016-11-30T09:56:45.333Z] Session [4d5ed1f0-b6e3-11e6-9eef-e1ed0fd2c25b] - page.settings - {"XSSAuditingEnabled":false,"javascriptCanCloseWindows":true,"javascriptCanOpenWindows":true,"javascriptEnabled":true,"loadImages":true,"localToRemoteUrlAccessEnabled":false,"userAgent":"Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/538.1 (KHTML, like Gecko) PhantomJS/2.1.1 Safari/538.1","webSecurityEnabled":true} | |
[INFO - 2016-11-30T09:56:45.333Z] Session [4d5ed1f0-b6e3-11e6-9eef-e1ed0fd2c25b] - page.customHeaders: - {} | |
[INFO - 2016-11-30T09:56:45.333Z] Session [4d5ed1f0-b6e3-11e6-9eef-e1ed0fd2c25b] - Session.negotiatedCapabilities - {"browserName":"phantomjs","version":"2.1.1","driverName":"ghostdriver","driverVersion":"1.2.0","platform":"windows-10-32bit","javascriptEnabled":true,"takesScreenshot":true,"handlesAlerts":false,"databaseEnabled":false,"locationContextEnabled":false,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"cssSelectorsEnabled":true,"webStorageEnabled":false,"rotatable":false,"acceptSslCerts":false,"nativeEvents":true,"proxy":{"proxyType":"direct"}} | |
[INFO - 2016-11-30T09:56:45.334Z] SessionManagerReqHand - _postNewSessionCommand - New Session Created: 4d5ed1f0-b6e3-11e6-9eef-e1ed0fd2c25b |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import win32gui | |
import time | |
import ctypes | |
import re | |
import win32con | |
from datetime import date, timedelta | |
from selenium import webdriver | |
from selenium.webdriver.common.by import By | |
from selenium.webdriver.support.ui import WebDriverWait | |
from selenium.webdriver.support import expected_conditions as EC | |
from selenium.common.exceptions import TimeoutException | |
ahkDll = ctypes.WinDLL("AutoHotkey.dll") | |
# region Setup | |
# move to .Ie if you want to debug. | |
# browser = webdriver.PhantomJS("C:/Users/ntruran.VEROSCREENING/PycharmProjects/Wipro/Browser/phantomjs.exe") | |
# browser_is_ie = False | |
browser = webdriver.Ie("C:/Users/ntruran.VEROSCREENING/PycharmProjects/Wipro/Browser/IEDriverServer.exe") | |
browser_is_ie = True | |
browser.get("https://iverify.wipro.com/iverify/bgAgencyLogin.do?method=loadPage") | |
time.sleep(2) | |
# endregion | |
# region Functions | |
def browser_wait(item_type, element_value): | |
try: | |
element_present = EC.presence_of_element_located((item_type, element_value)) | |
WebDriverWait(browser, 10).until(element_present) | |
except TimeoutException: | |
print("Timed out waiting for page to load") | |
sys.exit(1) | |
def error_handling(message): | |
print(message) | |
browser.quit() | |
sys.exit() | |
return | |
def window_exists(window_name): | |
try: | |
handle = win32gui.FindWindow(None, window_name) | |
except win32gui.error: | |
return False, handle | |
else: | |
return True, handle | |
# endregion | |
password = "" | |
# region Login | |
# close message from webpage. not required if browser is not .ie | |
if browser_is_ie: | |
win_exist = window_exists("Message from webpage") | |
if win_exist[0]: | |
win32gui.PostMessage(win_exist[1],win32con.WM_CLOSE,0,0) | |
time.sleep(2) | |
# check if server error | |
if re.match("[0-9]{3}", browser.title): | |
error_handling("Server error: " + browser.title) | |
# Login details | |
browser_wait(By.ID, "company") | |
el = browser.find_element_by_id("company") | |
for option in el.find_elements_by_tag_name('option'): | |
if option.text == "Wipro Technologies": | |
option.click() # select() in earlier versions of webdriver | |
break | |
browser.find_element_by_id("agencyNumber").send_keys("1240") | |
browser.find_element_by_id("pwdAgency").send_keys(password) | |
browser.find_element_by_name("Submit").click() | |
if browser_is_ie: | |
win_exist = window_exists("Message from webpage") | |
if win_exist[0]: | |
win32gui.PostMessage(win_exist[1],win32con.WM_CLOSE,0,0) | |
time.sleep(2) | |
browser.execute_script("candidateVerification()") | |
# endregion | |
# region Search setup | |
yesterday = date.today() - timedelta(1) | |
formatted_yesterday = yesterday.strftime("%d-%m-%Y") | |
formatted_today = date.today().strftime("%d-%m-%Y") | |
browser_wait(By.NAME, "from_date") | |
browser.execute_script('agencyQueryObj.from_date.value = "' + formatted_yesterday + '";') | |
browser.execute_script('agencyQueryObj.to_date.value = "' + formatted_today + '";') | |
browser.execute_script("validateForm()") | |
browser_wait(By.NAME, "SubmitToVerify") | |
verify_button_list = [] | |
seen = {} | |
for verify_button in browser.find_elements_by_name("SubmitToVerify"): | |
verify_button_list.append(verify_button.get_attribute("onclick")) | |
unique_list = [seen.setdefault(x, x) for x in verify_button_list if x not in seen] | |
# endregion | |
# region Candidate | |
for candidate in unique_list: | |
browser.execute_script(candidate) | |
browser_wait(By.ID, "UserLevelID") | |
time.sleep(2) | |
candidate_name = browser.find_element_by_name("CandidateName").get_attribute("value") | |
resume_number = browser.find_element_by_name("ResumeNumber").get_attribute("value") | |
tb_heads = browser.find_elements_by_class_name("TbHead") | |
for tbs in tb_heads: | |
if "@" in tbs.text: | |
screening_initiator = re.sub("\s[(].*", "", tbs.text) | |
break | |
# region Download files | |
spans = browser.find_elements_by_tag_name("span") | |
for span in spans: | |
if span.get_attribute("title") == "Click here to attach or view files.": | |
script = re.sub("(javascript: )", "", span.get_attribute("on_click")) + ";" | |
print(script) | |
browser.execute_script(script) | |
browser.switch_to_active_element() | |
browser_wait(By.PARTIAL_LINK_TEXT, "BRP") | |
print(browser.find_element_by_partial_link_text("BRP")) | |
# endregion | |
sys.exit(0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; file downloads ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
downloadDetails := {} | |
Loop % wb.document.getElementsByTagName("span").length | |
{ | |
if (wb.document.getElementsByTagName("span")[A_Index-1].getAttribute("title") = "Click here to attach or view files.") | |
{ | |
tmpTxt := wb.document.getElementsByTagName("span")[A_Index-1].getAttribute("onclick") | |
tmpTxt := StrReplace(tmpTxt, "javascript: unflaging();attachUploads(") | |
tmpTxt := StrReplace(tmpTxt, ")") | |
tmpTxt := StrReplace(tmpTxt, "'") | |
tmpTxt := StrReplace(tmpTxt, ", ", ",") | |
subEntity := StrSplit(tmpTxt, ",") | |
downloadDetails.Push(subEntity) | |
} | |
} | |
Loop % downloadDetails.length() | |
{ | |
AutoTrim, on | |
entityId := downloadDetails[A_Index][1] | |
entityId = %entityId% | |
entityDataId := downloadDetails[A_Index][2] | |
entityDataId = %entityDataId% | |
entityDesc := downloadDetails[A_Index][3] | |
entityDesc = %entityDesc% | |
masterId := downloadDetails[A_Index][4] | |
masterId = %masterId% | |
code := downloadDetails[A_Index][5] | |
code = %code% | |
if(wb.document.getElementById("finalReportUpload")) | |
wb.document.getElementById("finalReportUpload").value := "false" | |
fru := wb.document.getElementById("finalReportUpload").value | |
addressBuilder = https://iverify.wipro.com/iverify/BGVVerifyAction.do?Operation=rdpUploads&finalReportUpload=%fru%&masterId=%masterId%&ParentCode=%code%&EntityID=%entityId%&EntityDataId=%entityDataId%&EntityDesc=%entityDesc%&ActionType=Attach&page=Y&CompanyCode=WT&UserLevel=AG | |
Fwb := ComObjCreate("InternetExplorer.Application") | |
Fwb.Navigate(addressBuilder) | |
Sleep 1000 | |
Fwb.Visible := visibleInstance | |
Loop ; Loop sleep 100ms until window is not busy | |
Sleep,100 | |
Until (!Fwb.busy) | |
Sleep 1000 | |
filesArray := {} | |
Loop % Fwb.document.getElementsByTagName("a").length | |
{ | |
if(InStr(Fwb.document.getElementsByTagName("a")[A_Index-1].getAttribute("onclick"), "downloadfile(")) | |
{ | |
downloadFile := Fwb.document.getElementsByTagName("a")[A_Index-1].getAttribute("onclick") | |
downloadFile := StrReplace(downloadFile, "downloadFile(") | |
downloadFile := StrReplace(downloadFile, "'") | |
downloadFile := StrReplace(downloadFile, ");") | |
filesArray.Push(downloadFile) | |
} | |
} | |
Loop % filesArray.length() | |
{ | |
downloadArray := StrSplit(filesArray[A_Index], ",") | |
fileName := downloadArray[1] | |
entityDataId := downloadArray[2] | |
fileServer := downloadArray[3] | |
fileId := downloadArray[4] | |
address = https://iverify.wipro.com/iverify/AlfrescoServlet?Operation=Download&CompanyCode=WT&title=%fileName%&employeeNumber=%resumeNumber%&EntityId=%entityDataId%&MasterId=%masterId%&page=Y | |
UrlDownloadToFile, %address%, Candidate%candidateIndex%_%fileName% | |
} | |
Fwb.Quit() | |
} | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
subEntityIndex := [] | |
subEntityValues := {} | |
Loop % wb.document.getElementsByTagName("span").length | |
{ | |
if (InStr(wb.document.getElementsByTagName("span")[A_Index-1].getAttribute("onclick"), "showsubEntityDetails")) | |
{ | |
subEntityIndex.Push(A_Index) | |
tmpTxt := wb.document.getElementsByTagName("span")[A_Index-1].getAttribute("onclick") | |
tmpTxt := StrReplace(tmpTxt, "showSubEntityDetails(") | |
tmpTxt := StrReplace(tmpTxt, "'") | |
tmpTxt := StrReplace(tmpTxt, ");") | |
subEntity := StrSplit(tmpTxt, ",") | |
subEntityValues.Push(subEntity) | |
} | |
} | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; strings that can be gathered: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; "Candidate Name", "Resume Number", "Personal Details Details", "Criminal Check Details", "Eligibility Information Details", ; | |
;; "Previous Employment Details", "Educational History Details", "Roll Number", "No. of Months", "No. of Instances", ; | |
;; "Is Permanent Address same as Current Address", "Are you eligible to work in the UK/EEA?", "Do you need a work permit to work in the UK?", ; | |
;; "Do you require further leave to remain?" "First Name", "Middle Name", "Surname", "Date of Birth", "Town/City and Country of Birth", ; | |
;; "Any other Name including Maiden/Unmarried Name", "Mother Maiden Name", "Email Address", "Most Appropriate Telephone Number", "UK National Insurance Number", ; | |
;; "From Duration", "To Duration", "Address Type", "Address Line 1", "Address Line 2", "Town/City", "County", "Post Code", "Country", "Employer/Company Name", "Address"; | |
;; "Job Title", "Employee ID/Number", "HR Contact Name", "HR Contact Email", "Name of Line Manager 1", "Contact Email Address of Line Manager 1" ; | |
;; "Reason for Leaving", "Employment Status", "Agency Name (If Contractor)", "Agency Contact Number (If Contractor)", "Agency Contact Email (If Contractor)" ; | |
;; "School/College/University", "Course Title", "Qualification Title" ; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
try | |
; create an XMLDOMDocument object | |
; set its top-level node | |
x := new xml("<Request/>") | |
catch pe ; catch parsing error(if any) | |
MsgBox, 16, PARSE ERROR | |
, % "Exception thrown!!`n`nWhat: " pe.What "`nFile: " pe.File | |
. "`nLine: " pe.Line "`nMessage: " pe.Message "`nExtra: " pe.Extra | |
x.addElement("authentication", "Request") | |
x.addElement("screening_initiator", "//authentication", screening_initiator) | |
x.addElement("password", "//authentication", PasswordGenerate()) | |
x.addElement("candidate", "Request") | |
x.addElement("employments", "Request") | |
x.addElement("educations", "Request") | |
x.addElement("addresses", "Request") | |
personBool := false | |
addressBool := false | |
employmentBool := false | |
educationBool := false | |
addressNum := 0 | |
employmentNum := 0 | |
educationNum := 0 | |
Keywords := ["First Name", "Middle Name", "Surname", "Date of Birth", "Town/City and Country of Birth", "Any other Name including Maiden/Unmarried Name", "Mother Maiden Name", "Email Address", "Most Appropriate Telephone Number", "From Duration", "To Duration", "Address Type", "Address Line 1", "Address Line 2", "Town/City", "County", "Post Code", "Country", "Employer/Company Name", "Address", "Job Title", "Employee ID/Number", "HR Contact Name", "HR Contact Email", "Name of Line Manager 1", "Contact Email Address of Line Manager 1", "Reason for Leaving", "Employment Status", "Agency Name (If Contractor)", "Agency Contact Number (If Contractor)", "Agency Contact Email (If Contractor)", "School/College/University", "Course Title", "Qualification Title"] | |
ReformattedKeywords := ["Forename", "MiddleName", "Surname", "DateOfBirth", "CityCountryOfBirth", "AnyotherNameincludingMaidenUnmarriedName", "MotherMaidenName", "PersonalEmail", "HomeTel", "DateFrom", "DateTo", "AddressType", "AddressLine1", "AddressLine2", "Town", "County", "PostCode", "Country", "CompanyName", "PositionHeld", "EmployeeIDNumber", "HRContact", "HRContactEmail", "NameofLineManager1", "ContactEmailAddressofLineManager1", "ReasonforLeaving", "EmploymentStatus", "AgencyNameIfContractor", "AgencyContactNumberIfContractor", "AgencyContactEmailIfContractor", "InstitutionName", "CourseTitle", "Award"] | |
; when there's more time we could create an array of URLs and thread the script from this point to make it faster. | |
Loop % subEntityIndex.length() | |
{ | |
entityId := subEntityValues[A_Index][1] | |
entityDataId := subEntityValues[A_Index][2] | |
entityDesc := subEntityValues[A_Index][3] | |
baRequired := subEntityValues[A_Index][4] | |
startSequence := subEntityValues[A_Index][5] | |
addressBuilder = https://iverify.wipro.com/iverify/BGVVerifyAction.do?Operation=getSubEntityDataForResume&EntityDataId=%entityDataId%&EntityId=%entityId%&EntityDesc=%entityDesc%&ResumeNumber=%resumeNumber%&BaRequired=%baRequired%&CompanyCode=WT&UserLevel=AG&CandidateName=%candidateName%&SequenceNo=%startSequence% | |
Pwb := ComObjCreate("InternetExplorer.Application") | |
Pwb.Navigate(addressBuilder) | |
Pwb.Visible := visibleInstance | |
personBool := false | |
addressBool := false | |
employmentBool := false | |
educationBool := false | |
Loop ; Loop sleep 100ms until window is not busy | |
Sleep,100 | |
Until (!Pwb.busy) | |
inputButtons := [] | |
Loop % Pwb.document.getElementsbyTagName("input").length | |
{ | |
if (InStr(Pwb.document.getElementsbyTagName("input")[A_Index-1].getAttribute("onclick"), "viewDetails")) | |
{ | |
inputButtons.Push(A_Index-1) | |
} | |
} | |
inputIndex := 1 | |
Loop % inputButtons.Length() | |
{ | |
if (inputButtons.Length() > 1) | |
{ | |
Pwb.document.getElementsbyTagName("input")[inputButtons[A_Index]].Click() | |
sleep 5000 | |
} | |
AutoTrim, On | |
tmpTxt := Pwb.document.GetElementsBytagname("td")[1].innertext | |
tmpTxt = %tmpTxt% | |
if(tmpTxt = "Personal Details Details") | |
{ | |
personBool := true | |
} | |
else if (tmpTxt = "Criminal Check Details") | |
{ | |
addressNum += 1 | |
addressBool := true | |
element := "address" + addressNum | |
x.addElement(element , "//addresses") | |
} | |
else if (tmpTxt = "Previous Employment Details") | |
{ | |
employmentNum += 1 | |
employmentBool := true | |
element := "employment" + employmentNum | |
x.addElement(element , "//employments") | |
} | |
else if (tmpTxt = "Educational History Details") | |
{ | |
educationNum += 1 | |
educationBool := true | |
element := "education" + educationNum | |
x.addElement(element , "//educations") | |
} | |
; store everything with the class TbBody. These are the cell contents of every page. | |
Loop % Pwb.document.getElementsbyClassName("TbBody").length | |
{ | |
AutoTrim, On | |
tmpTxt := Reformat(Pwb.document.GetElementsBytagname("td")[A_Index].innertext, true) | |
tmpTxt2 := Reformat(Pwb.document.GetElementsBytagname("td")[A_Index+1].innertext, false) | |
If (tmpTxt = "NationalInsuranceNumber") | |
x.addElement(tmpTxt, "//candidate", tmpTxt2) | |
for index, obj in ReformattedKeywords | |
{ | |
If (tmpTxt = obj && tmpTxt2 != "--") ;; Nulls = -- | |
{ | |
if(personBool) | |
{ | |
if(tmpTxt = "PersonalEmail") | |
{ | |
x.addElement("username", "//authentication", tmpTxt2) | |
} | |
x.addElement(tmpTxt, "//candidate", tmpTxt2) | |
} | |
else if (addressBool) | |
{ | |
element := "//address" + addressNum | |
x.addElement(tmpTxt, element, tmpTxt2) | |
} | |
else if (employmentBool) | |
{ | |
element := "//employment" + employmentNum | |
x.addElement(tmpTxt, element, tmpTxt2) | |
} | |
else if (educationBool) | |
{ | |
element := "//education" + educationNum | |
x.addElement(tmpTxt, element, tmpTxt2) | |
} | |
} | |
} | |
} | |
inputIndex += 1 | |
} | |
Pwb.Quit() | |
} | |
xmlPath = Candidate%candidateIndex%.xml | |
x.transformXML() | |
x.save(xmlPath) | |
wb.Navigate("https://iverify.wipro.com/iverify/BGVVerifyAction.do?Operation=fetchVerifyRecordsForAgency") ; back to start | |
Loop ; Loop sleep 100ms until window is not busy | |
Sleep,100 | |
Until (!wb.busy) | |
} | |
wb.Quit() | |
ExitApp | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment