Add options.json

This commit is contained in:
PAlexanderFranklin 2023-08-30 18:16:18 -07:00
parent 7ef3b56f78
commit 88129ca20d
2 changed files with 9 additions and 2 deletions

3
options.json Normal file
View File

@ -0,0 +1,3 @@
{
"uberPhoneNumber": "4444567891"
}

View File

@ -1,11 +1,12 @@
import puppeteer from "puppeteer-core" import puppeteer from "puppeteer-core"
import * as utils from "./utils.js" import * as utils from "./utils.js"
import fs from "fs"
function sleep(ms) { function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms)) return new Promise((resolve) => setTimeout(resolve, ms))
} }
async function main() { async function main() {
let options = JSON.parse(fs.readFileSync("./options.json", "utf8"))
const browser = await puppeteer.launch({ const browser = await puppeteer.launch({
headless: false, headless: false,
ignoreHTTPSErrors: true, ignoreHTTPSErrors: true,
@ -50,7 +51,10 @@ async function main() {
console.log("Went to Page") console.log("Went to Page")
await page.waitForSelector(`input[id="PHONE_NUMBER_or_EMAIL_ADDRESS"]`) await page.waitForSelector(`input[id="PHONE_NUMBER_or_EMAIL_ADDRESS"]`)
await page.type(`input[id="PHONE_NUMBER_or_EMAIL_ADDRESS"]`, "1234567891") await page.type(
`input[id="PHONE_NUMBER_or_EMAIL_ADDRESS"]`,
options.uberPhoneNumber ?? "",
)
for (let i = 0; i < 100; i++) { for (let i = 0; i < 100; i++) {
await sleep(500) await sleep(500)