From 1c336aa6a9efe9483ea93e13672c952c9c712e65 Mon Sep 17 00:00:00 2001 From: "yichi.zwt" Date: Thu, 15 Aug 2024 16:00:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=E9=85=8D=E7=BD=AEnav?= =?UTF-8?q?igationTimeout=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/macaca-playwright.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/macaca-playwright.ts b/lib/macaca-playwright.ts index c676453..01d841f 100644 --- a/lib/macaca-playwright.ts +++ b/lib/macaca-playwright.ts @@ -40,6 +40,7 @@ type TDeviceCaps = { username?: string; password?: string; }; + navigationTimeout?: number; }; class Playwright extends DriverBase { @@ -144,6 +145,9 @@ class Playwright extends DriverBase { const browserContext = await this.browser.newContext(newContextOptions); browserContext.name = contextName; browserContext.index = index; + if (typeof this.args.navigationTimeout === 'number') { + browserContext.setDefaultNavigationTimeout(this.args.navigationTimeout); + } this.browserContexts.push(browserContext); this.browserContext = this.browserContexts[index]; this.pages.push(await this.browserContext.newPage());