Add some auto typing
This commit is contained in:
parent
36dcf02bcc
commit
7ef3b56f78
14
src/index.js
14
src/index.js
@ -12,9 +12,7 @@ async function main() {
|
||||
executablePath: "/usr/bin/chromium",
|
||||
})
|
||||
try {
|
||||
console.log("Opened Browser")
|
||||
const page = await browser.newPage()
|
||||
console.log("Opened Page")
|
||||
|
||||
await page.setRequestInterception(true)
|
||||
let usefulRequestHeaders = {}
|
||||
@ -33,24 +31,27 @@ async function main() {
|
||||
url.endsWith(".jpg") ||
|
||||
url.endsWith(".ico")
|
||||
) {
|
||||
console.log("aborted: ", url)
|
||||
request.abort()
|
||||
} else {
|
||||
console.log("request url", url)
|
||||
console.log("requested", url)
|
||||
request.continue()
|
||||
}
|
||||
})
|
||||
|
||||
page.on("response", async (response) => {
|
||||
const request = response.request()
|
||||
if (request.url().includes("desiredrequest.json")) {
|
||||
const text = await response.text()
|
||||
console.log(text)
|
||||
if (request.url().includes("getWebActivityFeed")) {
|
||||
console.log(response)
|
||||
}
|
||||
})
|
||||
|
||||
await page.goto("https://drivers.uber.com/earnings/activities")
|
||||
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++) {
|
||||
await sleep(500)
|
||||
if (usefulRequestHeaders["content-type"]) {
|
||||
@ -62,6 +63,7 @@ async function main() {
|
||||
}
|
||||
}
|
||||
console.log("after sleep loop")
|
||||
await sleep(50000)
|
||||
} catch (err) {
|
||||
console.error("Critical failure", err)
|
||||
} finally {
|
||||
|
Loading…
Reference in New Issue
Block a user