Created
March 21, 2018 01:42
-
-
Save agithony/2e7c8f1ab1fdb5bb5a05943c92aaef98 to your computer and use it in GitHub Desktop.
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
| for (let h = 1; h <= numPages; h++) { | |
| console.log("Page Number : " + h); | |
| let jobListLength = await page.evaluate((sel) => { | |
| let jobSelectorID = document.getElementById(sel); | |
| let jobSelectorTagName = jobSelectorID.getElementsByTagName("li"); | |
| return jobSelectorTagName.length; | |
| }, JOB_SELECTOR_ID); | |
| for (let i = 1; i <= jobListLength; i++) { | |
| let jobSelector = LIST_JOB_SELECTOR.replace("INDEX", i) | |
| let jobListing = await page.evaluate((sel) => { | |
| return document.querySelector(sel).innerText; | |
| }, jobSelector); | |
| arrayJobResults.push(jobListing); | |
| } | |
| if (numPages != 1) { | |
| await page.click(constants.STATE_FARM_NEXT_PAGE_SELECTOR); | |
| await page.waitFor(2000); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment