Refactored `script.py` by adding detailed docstrings and organizing functions. Created `.idea` configuration files and `gotodashboard.js` for `sisa_crawl` project. Added `readme.md` files with usage instructions and context for multiple scripts, and set up `package.json` for `sisa_crawl` dependencies.
43 lines
1.3 KiB
JavaScript
43 lines
1.3 KiB
JavaScript
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;
|