Skip to content

Commit

Permalink
feat: 支持配置navigationTimeout参数
Browse files Browse the repository at this point in the history
  • Loading branch information
echizen committed Aug 15, 2024
1 parent 4fe8521 commit 23e89c9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/macaca-playwright.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type TDeviceCaps = {
username?: string;
password?: string;
};
navigationTimeout?: number;
};

class Playwright extends DriverBase {
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit 23e89c9

Please sign in to comment.