// Import Astral
import { launch } from "jsr:@astral/astral";
// Secure credentials
const C_USERNAME = "xxxxxxxx"
const C_PASSWORD = "xxxxxxxx"
// Launch the browser
const browser = await launch();
// Open a new page
const page = await browser.newPage("https://adminportal.xxxxxxxxx.com/Account/LogOn", { waitUntil: 'networkidle0' });
// Enter username
const username = await page.$("#UserName");
await username!.type(C_USERNAME);
// Enter password
const password = await page.$("#Password");
await password!.type(C_PASSWORD);
// Click the submit button
const submit = await page.$("#login > input[type=submit]:nth-child(9)");
await Promise.all([
page.waitForNavigation(),
submit!.click()
])
// Take a screenshot of the page and save that to disk
const screenshot2 = await page.screenshot();
Deno.writeFileSync("screenshot2.png", screenshot2);
// Import Astral
import { launch } from "jsr:@astral/astral";
// Secure credentials
const C_USERNAME = "xxxxxxxx"
const C_PASSWORD = "xxxxxxxx"
// Launch the browser
const browser = await launch();
// Open a new page
const page = await browser.newPage("https://adminportal.xxxxxxxxx.com/Account/LogOn", { waitUntil: 'networkidle0' });
// Enter username
const username = await page.$("#UserName");
await username!.type(C_USERNAME);
// Enter password
const password = await page.$("#Password");
await password!.type(C_PASSWORD);
// Click the submit button
const submit = await page.$("#login > input[type=submit]:nth-child(9)");
await Promise.all([
page.waitForNavigation(),
submit!.click()
])
// Take a screenshot of the page and save that to disk
const screenshot2 = await page.screenshot();
Deno.writeFileSync("screenshot2.png", screenshot2);