chore: fix locator type check (#34682)

This commit is contained in:
Pavel Feldman 2025-02-07 14:53:28 -08:00 committed by GitHub
parent d5d47f2b6e
commit 88c01434c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 3 deletions

View File

@ -577,12 +577,13 @@ export class Page extends ChannelOwner<channels.PageChannel> implements api.Page
await this._channel.setWebSocketInterceptionPatterns({ patterns });
}
async screenshot(options: Omit<channels.PageScreenshotOptions, 'mask'> & { path?: string, mask?: Locator[] } = {}): Promise<Buffer> {
async screenshot(options: Omit<channels.PageScreenshotOptions, 'mask'> & { path?: string, mask?: api.Locator[] } = {}): Promise<Buffer> {
const mask = options.mask as Locator[] | undefined;
const copy: channels.PageScreenshotOptions = { ...options, mask: undefined };
if (!copy.type)
copy.type = determineScreenshotType(options);
if (options.mask) {
copy.mask = options.mask.map(locator => ({
if (mask) {
copy.mask = mask.map(locator => ({
frame: locator._frame._channel,
selector: locator._selector,
}));