fix: remove exposed function before cleanup

This commit is contained in:
yanlong.wang 2024-04-29 15:51:23 +08:00
parent bfc6d678d8
commit 059c8aa61e
No known key found for this signature in database
GPG Key ID: C0A623C0BADF9F37

View File

@ -82,6 +82,7 @@ export class PuppeteerControl extends AsyncService {
return page;
},
destroy: async (page) => {
await page.removeExposedFunction('reportSnapshot');
await page.browserContext().close();
},
validate: async (page) => {
@ -198,6 +199,9 @@ function giveSnapshot() {
await page.evaluateOnNewDocument(`
let aftershot = undefined;
const handlePageLoad = () => {
if (window.haltSnapshot) {
return;
}
if (document.readyState !== 'complete') {
return;
}