-
-
Notifications
You must be signed in to change notification settings - Fork 260
BrowserFrame.waitUntilComplete()
David Ortner edited this page Apr 10, 2025
·
5 revisions
Waits for all ongoing operations to complete. This includes operations such as loading resources and executing scripts.
async waitUntilComplete(): Promise<void>;Promise<void>
Set settings.debug.traceWaitUntilComplete to a time in ms to collect which tasks that are still open and their stack traces.
Read more about this under IOptionalBrowserSettings.
This method may get stuck when using intervals or timers in a loop. Long running timers or fetch requests will slow it down, as it will wait for them to complete.
You can use the settings timer.maxTimeout, timer.maxIntervalTime, timer.maxIntervalIterations and timer.preventTimerLoops to prevent this from happening with timers.
Read more about this under IOptionalBrowserSettings.
import { Browser } from 'happy-dom';
const browser = new Browser({
settings: {
timer: {
maxTimeout: 200,
maxIntervalTime: 10,
maxIntervalIterations: 1,
preventTimerLoops: true
}
}
});
const page = browser.newPage();
// Navigates page
await page.goto('https://github.com/capricorn86');
// Waits for the page to complete.
await page.mainFrame.waitUntilComplete();
Help Packages