diff --git a/package.json b/package.json index 86d34c0..dcb9c95 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fakebrowser", - "version": "0.0.64", + "version": "0.0.65", "description": "🤖 Fake fingerprints to bypass anti-bot systems. Simulate mouse and keyboard operations to make behavior like a real person.", "repository": { "type": "git", diff --git a/src/core/PptrToolkit.ts b/src/core/PptrToolkit.ts index b5567ee..ae4877a 100644 --- a/src/core/PptrToolkit.ts +++ b/src/core/PptrToolkit.ts @@ -161,7 +161,7 @@ export class PptrToolkit { return null } - static async getActivePage(browser: Browser, timeout = 10 * 1000): Promise { + static async getActivePage(browser: Browser, timeout = 10 * 1000): Promise { const start = new Date().getTime() while (new Date().getTime() - start < timeout) { @@ -173,10 +173,12 @@ export class PptrToolkit { const arr = [] for (const p of pages) { - if (await p.evaluate(() => { - return document.visibilityState == 'visible' - })) { - arr.push(p) + if (p) { + if (await p.evaluate(() => { + return document.visibilityState == 'visible' + })) { + arr.push(p) + } } }