Hi, we did the migration from js to ts and after that all our ui tests became flucky or failing. We did not have problems with js files. On ts we receive
page.waitForLoadState: Navigation failed because page was closed!
We have pretty common workflow
async view(): Promise<void> {
await test.step(`Load page: ${this.fullUrl}`, async () => {
await this.page.goto(this.fullUrl);
await this.page.waitForLoadState('networkidle');
});
}
I have also tried
await this.page.goto(this.fullUrl, { waitUntil: 'networkidle' });
Nothing helps me on ci/cd
Version for playwright 1.35.1 and 1.36.2, both give me same error
This thread is trying to answer question "Why am I receiving a 'Navigation failed because page was closed!' error when using the 'page.waitForLoadState' function in TypeScript after migrating from JavaScript?"
Unrelated to the question, networkidle is discouraged: https://playwright.dev/docs/next/api/class-frame#frame-wait-for-load-state
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].