Skip to content

Commit

Permalink
catch errors in new page handler (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
Miłosz Skaza authored Apr 8, 2023
1 parent 4d646f6 commit fdb02d2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/utils/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,14 @@ export class PlaywrightRunner {
// auto-close new pages after they reach load state.
// control over this can't be provided to the user because
// READ_ALERTS option needs to overwrite any handlers for new pages.
await page.waitForLoadState();
await page.close();

try {
await page.waitForLoadState();
await page.close();
} catch (e: any) {
// the page can be already closed if the browser begins working on the next step
// catch the error and ignore this
}
});
}

Expand Down

0 comments on commit fdb02d2

Please sign in to comment.