Add some auto typing

This commit is contained in:
PAlexanderFranklin 2023-08-30 17:57:49 -07:00
parent 36dcf02bcc
commit 7ef3b56f78

View File

@ -12,9 +12,7 @@ async function main() {
executablePath: "/usr/bin/chromium", executablePath: "/usr/bin/chromium",
}) })
try { try {
console.log("Opened Browser")
const page = await browser.newPage() const page = await browser.newPage()
console.log("Opened Page")
await page.setRequestInterception(true) await page.setRequestInterception(true)
let usefulRequestHeaders = {} let usefulRequestHeaders = {}
@ -33,24 +31,27 @@ async function main() {
url.endsWith(".jpg") || url.endsWith(".jpg") ||
url.endsWith(".ico") url.endsWith(".ico")
) { ) {
console.log("aborted: ", url)
request.abort() request.abort()
} else { } else {
console.log("request url", url) console.log("requested", url)
request.continue() request.continue()
} }
}) })
page.on("response", async (response) => { page.on("response", async (response) => {
const request = response.request() const request = response.request()
if (request.url().includes("desiredrequest.json")) { if (request.url().includes("getWebActivityFeed")) {
const text = await response.text() console.log(response)
console.log(text)
} }
}) })
await page.goto("https://drivers.uber.com/earnings/activities") await page.goto("https://drivers.uber.com/earnings/activities")
console.log("Went to Page") console.log("Went to Page")
await page.waitForSelector(`input[id="PHONE_NUMBER_or_EMAIL_ADDRESS"]`)
await page.type(`input[id="PHONE_NUMBER_or_EMAIL_ADDRESS"]`, "1234567891")
for (let i = 0; i < 100; i++) { for (let i = 0; i < 100; i++) {
await sleep(500) await sleep(500)
if (usefulRequestHeaders["content-type"]) { if (usefulRequestHeaders["content-type"]) {
@ -62,6 +63,7 @@ async function main() {
} }
} }
console.log("after sleep loop") console.log("after sleep loop")
await sleep(50000)
} catch (err) { } catch (err) {
console.error("Critical failure", err) console.error("Critical failure", err)
} finally { } finally {