How to wait for page/iframe to load completely using Astral
EDIT: I think what I am looking for is
How to wait for an iframe to load
How to wait for an iframe to load
. I most recently tried using
await page.waitForSelector('#duo_iframe')
await page.waitForSelector('#duo_iframe')
to wait for the ID of the iframe but this failed and timed out.
---
I am using Astral instead of playwright or puppeteer which I would normally use with Node and Astral is very similar to playwright but I can't get it to properly wait for my page to load for all the content.
// Import Astralimport { launch } from "jsr:@astral/astral";// Secure credentialsconst C_USERNAME = "xxxxxxxx"const C_PASSWORD = "xxxxxxxx"// Launch the browserconst browser = await launch();// Open a new pageconst page = await browser.newPage("https://adminportal.xxxxxxxxx.com/Account/LogOn", { waitUntil: 'networkidle0' });// Enter usernameconst username = await page.$("#UserName");await username!.type(C_USERNAME);// Enter passwordconst password = await page.$("#Password");await password!.type(C_PASSWORD);// Click the submit buttonconst 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 diskconst screenshot2 = await page.screenshot();Deno.writeFileSync("screenshot2.png", screenshot2);
// Import Astralimport { launch } from "jsr:@astral/astral";// Secure credentialsconst C_USERNAME = "xxxxxxxx"const C_PASSWORD = "xxxxxxxx"// Launch the browserconst browser = await launch();// Open a new pageconst page = await browser.newPage("https://adminportal.xxxxxxxxx.com/Account/LogOn", { waitUntil: 'networkidle0' });// Enter usernameconst username = await page.$("#UserName");await username!.type(C_USERNAME);// Enter passwordconst password = await page.$("#Password");await password!.type(C_PASSWORD);// Click the submit buttonconst 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 diskconst screenshot2 = await page.screenshot();Deno.writeFileSync("screenshot2.png", screenshot2);