Skip to content

Commit

Permalink
fix: 修复新 context 和默认 context 窗口大小不一致的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Jodeee committed Aug 16, 2023
1 parent 1ceccfd commit 43fc0e8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/macaca-playwright.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type TContextOptions = {
locale: string,
userAgent?: string,
recordVideo?: string,
viewport?: object,
};

class Playwright extends DriverBase {
Expand Down Expand Up @@ -63,6 +64,13 @@ class Playwright extends DriverBase {
});
}

if (this.args.width && this.args.height) {
newContextOptions.viewport = {
width: this.args.width,
height: this.args.height,
};
}

this.newContextOptions = newContextOptions;
await this._createContext();

Expand Down

0 comments on commit 43fc0e8

Please sign in to comment.