Created
July 9, 2019 00:42
-
-
Save JordynMarcellus/c652c410b402dde13850000ee31c4a9a to your computer and use it in GitHub Desktop.
This is a gist showing my current working building a puppeteer script to handle scraping the Toronto lobbyist registrar
This file contains 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
const puppeteer = require('puppeteer') | |
const URL = "http://app.toronto.ca/lobbyistsearch/searchInput.do" | |
const lobbyistRegistrarScraper = async function() { | |
const browser = await puppeteer.launch({headless: false}) | |
const browserPage = await browser.newPage() | |
await browserPage.goto(URL) | |
const element = await browserPage.$('[href="/lobbyistsearch/searchInput.do"') | |
await element.click() | |
await browserPage.waitForNavigation() | |
await browserPage.click('input[name="freeSearchSM"][value="Active"]') | |
await browserPage.select('select[name="fromMonth"]', "06") | |
await browserPage.select('select[name="toMonth"]', "06") | |
await browserPage.evaluate(() => { | |
doFreeTextSearch() | |
return false | |
}) | |
await browserPage.waitForNavigation() | |
await browserPage.screenshot({path: 'screenshot.png'}); | |
browser.close() | |
} | |
lobbyistRegistrarScraper().then(() => {}).catch(err => console.error(err)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment