const { email, password, webpage } = require("./vars.js"); async function runLoginScript(browser) { try { const page = await browser.newPage(); // Navigate to the login page await page.goto(webpage); // Wait for 5 seconds await new Promise((resolve) => setTimeout(resolve, 5000)); // Enter the email await page.type(".form-control[type='email']", email); console.log("email entered"); // Wait for 5 seconds await new Promise((resolve) => setTimeout(resolve, 5000)); //press enter keyboard await page.keyboard.press("Enter"); // Wait for 5 seconds await new Promise((resolve) => setTimeout(resolve, 5000)); // Enter the password await page.type(".form-control[type='password']", password); console.log("password entered"); await page.keyboard.press("Enter"); // Wait for 5 seconds await new Promise((resolve) => setTimeout(resolve, 5000)); // wait for the user to input the google auth code console.log("waiting for auth code"); await new Promise((resolve) => setTimeout(resolve, 15000)); return page } catch (error) { console.error("An error occurred:", error); } } module.exports = runLoginScript;