Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save evansiroky/0f26774a01ba535e4e7d88104e3bf7dc to your computer and use it in GitHub Desktop.
Save evansiroky/0f26774a01ba535e4e7d88104e3bf7dc to your computer and use it in GitHub Desktop.
{
"Name": "Download-Applications-From-ECOS",
"CreationDate": "2024-2-13",
"Commands": [
{
"Command": "store",
"Target": "fast",
"Value": "!replayspeed",
"Description": ""
},
{
"Command": "comment",
"Target": "This assumes that the user is currently starting on the \"Search Job Controls\" page.",
"Value": "",
"Description": ""
},
{
"Command": "comment",
"Target": "prompt // Enter job control ID",
"Value": "jobControlId",
"Description": ""
},
{
"Command": "comment",
"Target": "click // id=ctl00_ContentPlaceHolder_MainContent_txtJobControlCode",
"Value": "",
"Description": ""
},
{
"Command": "comment",
"Target": "type // id=ctl00_ContentPlaceHolder_MainContent_txtJobControlCode",
"Value": "${jobControlId}",
"Description": ""
},
{
"Command": "comment",
"Target": "click // id=ctl00_ContentPlaceHolder_MainContent_btnSearch",
"Value": "",
"Description": ""
},
{
"Command": "comment",
"Target": "waitForElementVisible // linkText=JC-${jobControlId}",
"Value": "",
"Description": ""
},
{
"Command": "comment",
"Target": "XClick // id=ctl00_ContentPlaceHolder_MainContent_gvResults_ctl02_btnSelectJobControl",
"Value": "",
"Description": ""
},
{
"Command": "comment",
"Target": "waitForElementVisible // id=ctl00_ContentPlaceHolder_MainContent_btnLink_JobApplications",
"Value": "",
"Description": ""
},
{
"Command": "comment",
"Target": "clickAndWait // id=ctl00_ContentPlaceHolder_MainContent_btnLink_JobApplications",
"Value": "",
"Description": ""
},
{
"Command": "comment",
"Target": "Job Apps Page",
"Value": "",
"Description": ""
},
{
"Command": "store",
"Target": "0",
"Value": "numXClicks",
"Description": ""
},
{
"Command": "store",
"Target": "${!URL}",
"Value": "jobAppsURL",
"Description": ""
},
{
"Command": "prompt",
"Target": "Enter stating page (macro assumes you're already on this page)",
"Value": "startingPage",
"Description": ""
},
{
"Command": "prompt",
"Target": "Enter stating app on starting page",
"Value": "startingApp",
"Description": ""
},
{
"Command": "if",
"Target": "isNaN(parseInt(${startingPage}, 10))",
"Value": "",
"Description": ""
},
{
"Command": "store",
"Target": "1",
"Value": "startingPage",
"Description": ""
},
{
"Command": "end",
"Target": "Enter stating app on starting page",
"Value": "startingApp",
"Description": ""
},
{
"Command": "if",
"Target": "isNaN(parseInt(${startingApp}, 10))",
"Value": "",
"Description": ""
},
{
"Command": "store",
"Target": "1",
"Value": "startingApp",
"Description": ""
},
{
"Command": "end",
"Target": "Enter stating app on starting page",
"Value": "startingApp",
"Description": ""
},
{
"Command": "executeScript",
"Target": "return Number(${startingPage}) + 1;",
"Value": "nextPage",
"Description": ""
},
{
"Command": "executeScript",
"Target": "var nextNum = Number (${startingApp}) + 1;\nreturn nextNum < 10 ? '0'+nextNum : nextNum;",
"Value": "curApp",
"Description": ""
},
{
"Command": "store",
"Target": "true",
"Value": "nextPageExists",
"Description": ""
},
{
"Command": "do",
"Target": "",
"Value": "",
"Description": ""
},
{
"Command": "store",
"Target": "true",
"Value": "nextAppExists",
"Description": ""
},
{
"Command": "do",
"Target": "",
"Value": "",
"Description": ""
},
{
"Command": "if",
"Target": "Number(${numXClicks}) > 21",
"Value": "",
"Description": ""
},
{
"Command": "executeScript",
"Target": "return Number(${nextPage}) - 1",
"Value": "nextStartingPage",
"Description": ""
},
{
"Command": "executeScript",
"Target": "return Number(${curApp}) - 1",
"Value": "nextStartingApp",
"Description": ""
},
{
"Command": "prompt",
"Target": "Free click limit reached. Start next batch with: page=${nextStartingPage}, app=${nextStartingApp}",
"Value": "",
"Description": ""
},
{
"Command": "assert",
"Target": "false",
"Value": "",
"Description": ""
},
{
"Command": "end",
"Target": "",
"Value": "",
"Description": ""
},
{
"Command": "store",
"Target": "id=ctl00_ContentPlaceHolder_MainContent_gvApps_ctl${curApp}_btnSelectApplication",
"Value": "nextAppElementId",
"Description": ""
},
{
"Command": "executeScript",
"Target": "return Number(${curApp}) - 1",
"Value": "rowNum",
"Description": ""
},
{
"Command": "verifyElementPresent",
"Target": "${nextAppElementId}",
"Value": "",
"Description": ""
},
{
"Command": "if",
"Target": "${!statusOK} != true",
"Value": "",
"Description": ""
},
{
"Command": "store",
"Target": "false",
"Value": "nextAppExists",
"Description": ""
},
{
"Command": "store",
"Target": "true",
"Value": "!statusOK",
"Description": ""
},
{
"Command": "else",
"Target": "",
"Value": "",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"ctl00_ContentPlaceHolder_MainContent_gvApps\"]/tbody/tr[${rowNum}]/td[4]",
"Value": "lastName",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//*[@id=\"ctl00_ContentPlaceHolder_MainContent_gvApps\"]/tbody/tr[${rowNum}]/td[5]",
"Value": "firstName",
"Description": ""
},
{
"Command": "XClick",
"Target": "${nextAppElementId}",
"Value": "",
"Targets": [
"linkText=View",
"id=ctl00_ContentPlaceHolder_MainContent_gvApps_ctl02_btnSelectApplication",
"xpath=//*[@id=\"ctl00_ContentPlaceHolder_MainContent_gvApps_ctl02_btnSelectApplication\"]",
"xpath=//a[@id='ctl00_ContentPlaceHolder_MainContent_gvApps_ctl02_btnSelectApplication']",
"xpath=//td/a",
"css=#ctl00_ContentPlaceHolder_MainContent_gvApps_ctl02_btnSelectApplication"
],
"Description": ""
},
{
"Command": "XClick",
"Target": "id=ctl00_ContentPlaceHolder_MainContent_btnLink_ApplicationDocuments",
"Value": "",
"Targets": [
"id=ctl00_ContentPlaceHolder_MainContent_btnLink_ApplicationDocuments",
"linkText=Application Docs (1)",
"linkText=Application Docs (2)",
"linkText=Application Docs (3)",
"linkText=Application Docs (4)",
"linkText=Application Docs (5)",
"linkText=Application Docs (6)",
"linkText=Application Docs (7)",
"linkText=Application Docs (8)",
"xpath=//*[@id=\"ctl00_ContentPlaceHolder_MainContent_btnLink_ApplicationDocuments\"]",
"xpath=//a[@id='ctl00_ContentPlaceHolder_MainContent_btnLink_ApplicationDocuments']",
"xpath=//fieldset/ul/li/a",
"css=#ctl00_ContentPlaceHolder_MainContent_btnLink_ApplicationDocuments"
],
"Description": ""
},
{
"Command": "waitForElementVisible",
"Target": "id=ctl00_ContentPlaceHolder_MainContent_btnGeneratePDF",
"Value": "",
"Targets": [
"id=ctl00_ContentPlaceHolder_MainContent_btnGeneratePDF",
"name=ctl00$ContentPlaceHolder_MainContent$btnGeneratePDF",
"xpath=//*[@id=\"ctl00_ContentPlaceHolder_MainContent_btnGeneratePDF\"]",
"xpath=//input[@id='ctl00_ContentPlaceHolder_MainContent_btnGeneratePDF']",
"xpath=//div[4]/div/input[2]",
"css=#ctl00_ContentPlaceHolder_MainContent_btnGeneratePDF"
],
"Description": ""
},
{
"Command": "comment",
"Target": "Make sure Chrome does not ask where to download each file, and also change the download folder if needed",
"Value": "",
"Description": ""
},
{
"Command": "onDownload",
"Target": "${lastName}, ${firstName}.pdf",
"Value": "true",
"Description": ""
},
{
"Command": "XClick",
"Target": "id=ctl00_ContentPlaceHolder_MainContent_btnGeneratePDF",
"Value": "",
"Targets": [
"id=ctl00_ContentPlaceHolder_MainContent_btnGeneratePDF",
"name=ctl00$ContentPlaceHolder_MainContent$btnGeneratePDF",
"xpath=//*[@id=\"ctl00_ContentPlaceHolder_MainContent_btnGeneratePDF\"]",
"xpath=//input[@id='ctl00_ContentPlaceHolder_MainContent_btnGeneratePDF']",
"xpath=//div[4]/div/input[2]",
"css=#ctl00_ContentPlaceHolder_MainContent_btnGeneratePDF"
],
"Description": ""
},
{
"Command": "pause",
"Target": "5000",
"Value": "",
"Description": "needed to ensure the download begins"
},
{
"Command": "open",
"Target": "${jobAppsURL}",
"Value": "",
"Description": ""
},
{
"Command": "end",
"Target": "",
"Value": "",
"Description": ""
},
{
"Command": "executeScript",
"Target": "var nextNum = Number (${curApp}) + 1;\nreturn nextNum < 10 ? '0'+nextNum : nextNum;",
"Value": "curApp",
"Description": ""
},
{
"Command": "executeScript",
"Target": "return Number (${numXClicks}) + 3;",
"Value": "numXClicks",
"Description": ""
},
{
"Command": "repeatIf",
"Target": "${nextAppExists} == \"true\"",
"Value": "",
"Description": ""
},
{
"Command": "if",
"Target": "${nextPage} == 6",
"Value": "",
"Description": ""
},
{
"Command": "store",
"Target": "...",
"Value": "nextLinkText",
"Description": ""
},
{
"Command": "else",
"Target": "...",
"Value": "nextLinkText",
"Description": ""
},
{
"Command": "store",
"Target": "${nextPage}",
"Value": "nextLinkText",
"Description": ""
},
{
"Command": "end",
"Target": "",
"Value": "",
"Description": ""
},
{
"Command": "verifyElementPresent",
"Target": "linkText=${nextLinkText}",
"Value": "",
"Targets": [
"linkText=2",
"xpath=//*[@id=\"ctl00_ContentPlaceHolder_MainContent_gvApps\"]/tfoot/tr/td/table/tbody/tr/td[2]/a",
"xpath=//td[2]/a",
"css=#ctl00_ContentPlaceHolder_MainContent_gvApps > tfoot > tr > td > table > tbody > tr > td:nth-child(2) > a"
],
"Description": ""
},
{
"Command": "if",
"Target": "${!statusOK} != true",
"Value": "",
"Description": ""
},
{
"Command": "store",
"Target": "false",
"Value": "nextPageExists",
"Description": ""
},
{
"Command": "store",
"Target": "true",
"Value": "!statusOK",
"Description": ""
},
{
"Command": "else",
"Target": "",
"Value": "",
"Description": ""
},
{
"Command": "XClick",
"Target": "linkText=${nextLinkText}",
"Value": "",
"Targets": [
"linkText=2",
"xpath=//*[@id=\"ctl00_ContentPlaceHolder_MainContent_gvApps\"]/tfoot/tr/td/table/tbody/tr/td[2]/a",
"xpath=//td[2]/a",
"css=#ctl00_ContentPlaceHolder_MainContent_gvApps > tfoot > tr > td > table > tbody > tr > td:nth-child(2) > a"
],
"Description": ""
},
{
"Command": "executeScript",
"Target": "return Number (${numXClicks}) + 1;",
"Value": "numXClicks",
"Description": ""
},
{
"Command": "end",
"Target": "",
"Value": "",
"Description": ""
},
{
"Command": "executeScript",
"Target": "return Number (${nextPage}) + 1",
"Value": "nextPage",
"Description": ""
},
{
"Command": "store",
"Target": "02",
"Value": "curApp",
"Description": ""
},
{
"Command": "repeatIf",
"Target": "${nextPageExists} == \"true\"",
"Value": "",
"Description": ""
},
{
"Command": "echo",
"Target": "Finished Successfully!",
"Value": "",
"Description": ""
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment