diff --git a/.claude/skills/playwright-dev/library.md b/.claude/skills/playwright-dev/library.md index 1a6fa28946cef..52456a47cbbcc 100644 --- a/.claude/skills/playwright-dev/library.md +++ b/.claude/skills/playwright-dev/library.md @@ -7,12 +7,12 @@ Playwright uses a client-server architecture connected by a protocol layer. The ``` packages/protocol/src/ protocol.yml — RPC protocol definition (source of truth) - channels.d.ts — generated TypeScript channel interfaces - callMetadata.d.ts — call metadata types packages/playwright-core/src/ client/ — public API objects (ChannelOwner subclasses) + channels.d.ts — generated client channel interfaces server/ — browser automation implementation (SdkObject subclasses) + channels.d.ts — generated server channel interfaces server/dispatchers/ — protocol bridge (Dispatcher subclasses) protocol/ — validators (generated + primitives) utils/isomorphic/ — shared code used by both client and server diff --git a/packages/dashboard/vite.config.ts b/packages/dashboard/vite.config.ts index d4f0b3ad9b1c8..5356d3365c475 100644 --- a/packages/dashboard/vite.config.ts +++ b/packages/dashboard/vite.config.ts @@ -27,7 +27,6 @@ export default defineConfig({ resolve: { alias: { '@isomorphic': path.resolve(__dirname, '../isomorphic'), - '@protocol': path.resolve(__dirname, '../protocol/src'), '@web': path.resolve(__dirname, '../web/src'), '@trace-viewer': path.resolve(__dirname, '../trace-viewer/src'), }, diff --git a/packages/injected/src/injectedScript.ts b/packages/injected/src/injectedScript.ts index f91fdbed3bde2..6c265ae8ff9dc 100644 --- a/packages/injected/src/injectedScript.ts +++ b/packages/injected/src/injectedScript.ts @@ -37,7 +37,6 @@ import type { AriaTemplateNode } from '@isomorphic/ariaSnapshot'; import type { CSSComplexSelectorList } from '@isomorphic/cssParser'; import type { Language } from '@isomorphic/locatorGenerators'; import type { AttributeSelectorPart, NestedSelectorBody, ParsedSelector, ParsedSelectorPart } from '@isomorphic/selectorParser'; -import type * as channels from '@protocol/channels'; import type { AriaSnapshot, AriaTreeOptions } from './ariaSnapshot'; import type { LayoutSelectorName } from './layoutSelectorUtils'; import type { SelectorEngine, SelectorRoot } from './selectorEngine'; @@ -46,8 +45,28 @@ import type { ElementText, TextMatcher } from './selectorUtils'; import type { Builtins } from './utilityScript'; -export type FrameExpectParams = Omit & { - expectedValue?: any; +type ExpectedTextValue = { + string?: string, + regexSource?: string, + regexFlags?: string, + matchSubstring?: boolean, + ignoreCase?: boolean, + normalizeWhiteSpace?: boolean, +}; + +type Point = { x: number, y: number }; +type Rect = Point & { width: number, height: number }; + +export type FrameExpectParams = { + selector?: string, + expression: string, + expressionArg?: any, + pseudo?: 'before' | 'after', + expectedText?: ExpectedTextValue[], + expectedNumber?: number, + expectedValue?: any, + useInnerText?: boolean, + isNot: boolean, }; export type ElementState = 'visible' | 'hidden' | 'enabled' | 'disabled' | 'editable' | 'checked' | 'unchecked' | 'indeterminate' | 'stable'; @@ -1337,7 +1356,7 @@ export class InjectedScript { highlight.removeElementHighlight(selector); } - setScreencastAnnotation(annotation: { point?: channels.Point, box?: channels.Rect, actionTitle?: string, duration?: number, position?: string, fontSize?: number, cursor?: 'none' | 'pointer' } | null) { + setScreencastAnnotation(annotation: { point?: Point, box?: Rect, actionTitle?: string, duration?: number, position?: string, fontSize?: number, cursor?: 'none' | 'pointer' } | null) { const highlight = this._ensureHighlight(); if (!annotation) { highlight.updateHighlight([]); @@ -1722,7 +1741,7 @@ export class InjectedScript { } private _matchSequentially( - expectedText: channels.ExpectedTextValue[], + expectedText: ExpectedTextValue[], received: T[], matchFn: (matcher: ExpectedTextMatcher, received: T) => boolean ): boolean { @@ -1811,7 +1830,7 @@ class ExpectedTextMatcher { private _normalizeWhiteSpace: boolean | undefined; private _ignoreCase: boolean | undefined; - constructor(expected: channels.ExpectedTextValue) { + constructor(expected: ExpectedTextValue) { this._normalizeWhiteSpace = expected.normalizeWhiteSpace; this._ignoreCase = expected.ignoreCase; this._string = expected.matchSubstring ? undefined : this.normalize(expected.string); diff --git a/packages/injected/src/storageScript.ts b/packages/injected/src/storageScript.ts index 6f25ce96693ee..13ec974c011e7 100644 --- a/packages/injected/src/storageScript.ts +++ b/packages/injected/src/storageScript.ts @@ -16,9 +16,42 @@ import { parseEvaluationResultValue, serializeAsCallArgument } from '@isomorphic/utilityScriptSerializers'; -import type * as channels from '@protocol/channels'; - -export type SerializedStorage = Omit; +type NameValue = { name: string, value: string }; + +type IndexedDBDatabase = { + name: string, + version: number, + stores: { + name: string, + autoIncrement: boolean, + keyPath?: string, + keyPathArray?: string[], + records: { + key?: any, + keyEncoded?: any, + value?: any, + valueEncoded?: any, + }[], + indexes: { + name: string, + keyPath?: string, + keyPathArray?: string[], + multiEntry: boolean, + unique: boolean, + }[], + }[], +}; + +type SetOriginStorage = { + origin: string, + localStorage: NameValue[], + indexedDB?: IndexedDBDatabase[], +}; + +export type SerializedStorage = { + localStorage: NameValue[], + indexedDB?: IndexedDBDatabase[], +}; export class StorageScript { private _isFirefox: boolean; @@ -85,7 +118,7 @@ export class StorageScript { const keys = await this._idbRequestToPromise(objectStore.getAllKeys()); const records = await Promise.all(keys.map(async key => { - const record: channels.IndexedDBDatabase['stores'][0]['records'][0] = {}; + const record: IndexedDBDatabase['stores'][0]['records'][0] = {}; if (objectStore.keyPath === null) { const { encoded, trivial } = this._trySerialize(key); @@ -146,7 +179,7 @@ export class StorageScript { } } - private async _restoreDB(dbInfo: channels.IndexedDBDatabase) { + private async _restoreDB(dbInfo: IndexedDBDatabase) { const openRequest = this._global.indexedDB.open(dbInfo.name, dbInfo.version); openRequest.addEventListener('upgradeneeded', () => { const db = openRequest.result; @@ -176,7 +209,7 @@ export class StorageScript { })); } - async restore(originState: channels.SetOriginStorage | undefined) { + async restore(originState: SetOriginStorage | undefined) { // Clean Service Workers. const registrations = this._global.navigator.serviceWorker ? await this._global.navigator.serviceWorker.getRegistrations() : []; await Promise.all(registrations.map(async r => { diff --git a/packages/isomorphic/expectUtils.ts b/packages/isomorphic/expectUtils.ts deleted file mode 100644 index e7be8db8528aa..0000000000000 --- a/packages/isomorphic/expectUtils.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { isRegExp, isString } from './rtti'; -import type { ExpectedTextValue } from '@protocol/channels'; - -export function serializeExpectedTextValues(items: (string | RegExp)[], options: { matchSubstring?: boolean, normalizeWhiteSpace?: boolean, ignoreCase?: boolean } = {}): ExpectedTextValue[] { - return items.map(i => ({ - string: isString(i) ? i : undefined, - regexSource: isRegExp(i) ? i.source : undefined, - regexFlags: isRegExp(i) ? i.flags : undefined, - matchSubstring: options.matchSubstring, - ignoreCase: options.ignoreCase, - normalizeWhiteSpace: options.normalizeWhiteSpace, - })); -} diff --git a/packages/isomorphic/index.ts b/packages/isomorphic/index.ts index fd97cdfbcfffb..f645b878b780e 100644 --- a/packages/isomorphic/index.ts +++ b/packages/isomorphic/index.ts @@ -15,7 +15,6 @@ */ export * from './ariaSnapshot'; -export * from './expectUtils'; export * from './assert'; export * from './base64'; export * from './colors'; diff --git a/packages/isomorphic/platform.ts b/packages/isomorphic/platform.ts index 7c27221cc47d7..497b50cff75fd 100644 --- a/packages/isomorphic/platform.ts +++ b/packages/isomorphic/platform.ts @@ -20,7 +20,6 @@ import type * as fs from 'fs'; import type * as path from 'path'; import type { Readable, Writable } from 'stream'; import type { Colors } from '@isomorphic/colors'; -import type * as channels from '@protocol/channels'; export type Zone = { push(data: unknown): Zone; @@ -29,6 +28,16 @@ export type Zone = { data(): T | undefined; }; +export type StreamChannel = { + read(params: { size?: number }): Promise<{ binary: Buffer }>; + close(params?: {}): Promise; +}; + +export type WritableStreamChannel = { + write(params: { binary: Buffer }): Promise; + close(params?: {}): Promise; +}; + const noopZone: Zone = { push: () => noopZone, pop: () => noopZone, @@ -57,8 +66,8 @@ export type Platform = { pathSeparator: string; showInternalStackFrames: () => boolean, streamFile: (path: string, writable: Writable) => Promise, - streamReadable: (channel: channels.StreamChannel) => Readable, - streamWritable: (channel: channels.WritableStreamChannel) => Writable, + streamReadable: (channel: StreamChannel) => Readable, + streamWritable: (channel: WritableStreamChannel) => Writable, zones: { empty: Zone, current: () => Zone; }; }; @@ -111,11 +120,11 @@ export const emptyPlatform: Platform = { throw new Error('Streams are not available'); }, - streamReadable: (channel: channels.StreamChannel) => { + streamReadable: (channel: StreamChannel) => { throw new Error('Streams are not available'); }, - streamWritable: (channel: channels.WritableStreamChannel) => { + streamWritable: (channel: WritableStreamChannel) => { throw new Error('Streams are not available'); }, diff --git a/packages/isomorphic/trace/traceModel.ts b/packages/isomorphic/trace/traceModel.ts index ea8381f910c26..f6f9187dd6a96 100644 --- a/packages/isomorphic/trace/traceModel.ts +++ b/packages/isomorphic/trace/traceModel.ts @@ -16,12 +16,12 @@ import { getActionGroup, renderTitleForCall } from '../protocolFormatter'; +import type { StackFrame } from '../stackTrace'; import type { Language } from '../locatorGenerators'; import type { ResourceSnapshot } from '@trace/snapshot'; import type * as trace from '@trace/trace'; import type { ActionTraceEvent } from '@trace/trace'; import type { ActionEntry, ContextEntry, PageEntry } from './entries'; -import type { StackFrame } from '@protocol/channels'; import type { ActionGroup } from '../protocolFormatter'; const contextSymbol = Symbol('context'); diff --git a/packages/isomorphic/trace/traceUtils.ts b/packages/isomorphic/trace/traceUtils.ts index f077cc5c4b4a1..aa11c397aca4f 100644 --- a/packages/isomorphic/trace/traceUtils.ts +++ b/packages/isomorphic/trace/traceUtils.ts @@ -14,7 +14,12 @@ * limitations under the License. */ -import type { ClientSideCallMetadata, StackFrame } from '@protocol/channels'; +import type { StackFrame } from '../stackTrace'; + +type ClientSideCallMetadata = { + id: number, + stack?: StackFrame[], +}; export type SerializedStackFrame = [number, number, number, string]; export type SerializedStack = [number, SerializedStackFrame[]]; diff --git a/packages/playwright-core/src/client/android.ts b/packages/playwright-core/src/client/android.ts index 3f6ad60f04c02..8286a92e1cc0f 100644 --- a/packages/playwright-core/src/client/android.ts +++ b/packages/playwright-core/src/client/android.ts @@ -31,7 +31,7 @@ import type * as types from './types'; import type * as api from '../../types/types'; import type { AndroidServerLauncherImpl } from '../androidServerImpl'; import type { Platform } from '@isomorphic/platform'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; import type { Playwright } from './playwright'; type Direction = 'down' | 'up' | 'left' | 'right'; diff --git a/packages/playwright-core/src/client/artifact.ts b/packages/playwright-core/src/client/artifact.ts index 7c6fd947cfdb7..794d327037555 100644 --- a/packages/playwright-core/src/client/artifact.ts +++ b/packages/playwright-core/src/client/artifact.ts @@ -18,7 +18,7 @@ import { ChannelOwner } from './channelOwner'; import { Stream } from './stream'; import { mkdirIfNeeded } from './fileUtils'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; import type { Readable } from 'stream'; export class Artifact extends ChannelOwner { diff --git a/packages/playwright-core/src/client/browser.ts b/packages/playwright-core/src/client/browser.ts index 010d16bb5f43e..d11adf305ede8 100644 --- a/packages/playwright-core/src/client/browser.ts +++ b/packages/playwright-core/src/client/browser.ts @@ -26,7 +26,7 @@ import type { BrowserType } from './browserType'; import type { Page } from './page'; import type { BrowserContextOptions, LaunchOptions, Logger } from './types'; import type * as api from '../../types/types'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; export class Browser extends ChannelOwner implements api.Browser { readonly _contexts = new Set(); diff --git a/packages/playwright-core/src/client/browserContext.ts b/packages/playwright-core/src/client/browserContext.ts index ff4b4241de878..e450deaeb8d25 100644 --- a/packages/playwright-core/src/client/browserContext.ts +++ b/packages/playwright-core/src/client/browserContext.ts @@ -48,7 +48,7 @@ import type * as structs from '../../types/structs'; import type * as api from '../../types/types'; import type { URLMatch } from '@isomorphic/urlMatch'; import type { Platform } from '@isomorphic/platform'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; import type * as actions from '@recorder/actions'; interface RecorderEventSink { diff --git a/packages/playwright-core/src/client/browserType.ts b/packages/playwright-core/src/client/browserType.ts index c0af1bda9d946..a37aca97c6c66 100644 --- a/packages/playwright-core/src/client/browserType.ts +++ b/packages/playwright-core/src/client/browserType.ts @@ -27,7 +27,7 @@ import { Worker } from './worker'; import type { Playwright } from './playwright'; import type { ConnectOptions, LaunchOptions, LaunchPersistentContextOptions, LaunchServerOptions } from './types'; import type * as api from '../../types/types'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; import type { ChildProcess } from 'child_process'; export interface BrowserServerLauncher { diff --git a/packages/playwright-core/src/client/cdpSession.ts b/packages/playwright-core/src/client/cdpSession.ts index d27b2aaeb29e0..57a08aefa5c8c 100644 --- a/packages/playwright-core/src/client/cdpSession.ts +++ b/packages/playwright-core/src/client/cdpSession.ts @@ -18,7 +18,7 @@ import { ChannelOwner } from './channelOwner'; import type * as api from '../../types/types'; import type { Protocol } from '../server/chromium/protocol'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; export class CDPSession extends ChannelOwner implements api.CDPSession { static from(cdpSession: channels.CDPSessionChannel): CDPSession { diff --git a/packages/playwright-core/src/client/channelOwner.ts b/packages/playwright-core/src/client/channelOwner.ts index 75422652542e7..781b2e86a94b0 100644 --- a/packages/playwright-core/src/client/channelOwner.ts +++ b/packages/playwright-core/src/client/channelOwner.ts @@ -25,7 +25,7 @@ import type { Connection } from './connection'; import type { Logger } from './types'; import type { ValidatorContext } from '../protocol/validator'; import type { Platform } from '@isomorphic/platform'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; type Listener = (...args: any[]) => void; diff --git a/packages/protocol/src/channels.d.ts b/packages/playwright-core/src/client/channels.d.ts similarity index 81% rename from packages/protocol/src/channels.d.ts rename to packages/playwright-core/src/client/channels.d.ts index ddec4af4c34a1..3d116fac27996 100644 --- a/packages/protocol/src/channels.d.ts +++ b/packages/playwright-core/src/client/channels.d.ts @@ -15,10 +15,6 @@ */ // This file is generated by generate_channels.js, do not edit manually. - -import type { CallMetadata } from './callMetadata'; -import type { Progress } from './progress'; - export type Binary = Buffer; export interface Channel { @@ -144,7 +140,7 @@ export interface AndroidEventTarget { } export interface AndroidChannel extends AndroidEventTarget, Channel { _type_Android: boolean; - devices(params: AndroidDevicesParams, progress?: Progress): Promise; + devices(params: AndroidDevicesParams): Promise; } export type AndroidDevicesParams = { host?: string, @@ -171,8 +167,8 @@ export interface AndroidSocketEventTarget { } export interface AndroidSocketChannel extends AndroidSocketEventTarget, Channel { _type_AndroidSocket: boolean; - write(params: AndroidSocketWriteParams, progress?: Progress): Promise; - close(params?: AndroidSocketCloseParams, progress?: Progress): Promise; + write(params: AndroidSocketWriteParams): Promise; + close(params?: AndroidSocketCloseParams): Promise; } export type AndroidSocketDataEvent = { data: Binary, @@ -206,30 +202,30 @@ export interface AndroidDeviceEventTarget { } export interface AndroidDeviceChannel extends AndroidDeviceEventTarget, Channel { _type_AndroidDevice: boolean; - wait(params: AndroidDeviceWaitParams, progress?: Progress): Promise; - fill(params: AndroidDeviceFillParams, progress?: Progress): Promise; - tap(params: AndroidDeviceTapParams, progress?: Progress): Promise; - drag(params: AndroidDeviceDragParams, progress?: Progress): Promise; - fling(params: AndroidDeviceFlingParams, progress?: Progress): Promise; - longTap(params: AndroidDeviceLongTapParams, progress?: Progress): Promise; - pinchClose(params: AndroidDevicePinchCloseParams, progress?: Progress): Promise; - pinchOpen(params: AndroidDevicePinchOpenParams, progress?: Progress): Promise; - scroll(params: AndroidDeviceScrollParams, progress?: Progress): Promise; - swipe(params: AndroidDeviceSwipeParams, progress?: Progress): Promise; - info(params: AndroidDeviceInfoParams, progress?: Progress): Promise; - screenshot(params?: AndroidDeviceScreenshotParams, progress?: Progress): Promise; - inputType(params: AndroidDeviceInputTypeParams, progress?: Progress): Promise; - inputPress(params: AndroidDeviceInputPressParams, progress?: Progress): Promise; - inputTap(params: AndroidDeviceInputTapParams, progress?: Progress): Promise; - inputSwipe(params: AndroidDeviceInputSwipeParams, progress?: Progress): Promise; - inputDrag(params: AndroidDeviceInputDragParams, progress?: Progress): Promise; - launchBrowser(params: AndroidDeviceLaunchBrowserParams, progress?: Progress): Promise; - open(params: AndroidDeviceOpenParams, progress?: Progress): Promise; - shell(params: AndroidDeviceShellParams, progress?: Progress): Promise; - installApk(params: AndroidDeviceInstallApkParams, progress?: Progress): Promise; - push(params: AndroidDevicePushParams, progress?: Progress): Promise; - connectToWebView(params: AndroidDeviceConnectToWebViewParams, progress?: Progress): Promise; - close(params?: AndroidDeviceCloseParams, progress?: Progress): Promise; + wait(params: AndroidDeviceWaitParams): Promise; + fill(params: AndroidDeviceFillParams): Promise; + tap(params: AndroidDeviceTapParams): Promise; + drag(params: AndroidDeviceDragParams): Promise; + fling(params: AndroidDeviceFlingParams): Promise; + longTap(params: AndroidDeviceLongTapParams): Promise; + pinchClose(params: AndroidDevicePinchCloseParams): Promise; + pinchOpen(params: AndroidDevicePinchOpenParams): Promise; + scroll(params: AndroidDeviceScrollParams): Promise; + swipe(params: AndroidDeviceSwipeParams): Promise; + info(params: AndroidDeviceInfoParams): Promise; + screenshot(params?: AndroidDeviceScreenshotParams): Promise; + inputType(params: AndroidDeviceInputTypeParams): Promise; + inputPress(params: AndroidDeviceInputPressParams): Promise; + inputTap(params: AndroidDeviceInputTapParams): Promise; + inputSwipe(params: AndroidDeviceInputSwipeParams): Promise; + inputDrag(params: AndroidDeviceInputDragParams): Promise; + launchBrowser(params: AndroidDeviceLaunchBrowserParams): Promise; + open(params: AndroidDeviceOpenParams): Promise; + shell(params: AndroidDeviceShellParams): Promise; + installApk(params: AndroidDeviceInstallApkParams): Promise; + push(params: AndroidDevicePushParams): Promise; + connectToWebView(params: AndroidDeviceConnectToWebViewParams): Promise; + close(params?: AndroidDeviceCloseParams): Promise; } export type AndroidDeviceCloseEvent = {}; export type AndroidDeviceWebViewAddedEvent = { @@ -646,12 +642,12 @@ export interface APIRequestContextEventTarget { } export interface APIRequestContextChannel extends APIRequestContextEventTarget, Channel { _type_APIRequestContext: boolean; - fetch(params: APIRequestContextFetchParams, progress?: Progress): Promise; - fetchResponseBody(params: APIRequestContextFetchResponseBodyParams, progress?: Progress): Promise; - fetchLog(params: APIRequestContextFetchLogParams, progress?: Progress): Promise; - storageState(params: APIRequestContextStorageStateParams, progress?: Progress): Promise; - disposeAPIResponse(params: APIRequestContextDisposeAPIResponseParams, progress?: Progress): Promise; - dispose(params: APIRequestContextDisposeParams, progress?: Progress): Promise; + fetch(params: APIRequestContextFetchParams): Promise; + fetchResponseBody(params: APIRequestContextFetchResponseBodyParams): Promise; + fetchLog(params: APIRequestContextFetchLogParams): Promise; + storageState(params: APIRequestContextStorageStateParams): Promise; + disposeAPIResponse(params: APIRequestContextDisposeAPIResponseParams): Promise; + dispose(params: APIRequestContextDisposeParams): Promise; } export type APIRequestContextFetchParams = { url: string, @@ -750,13 +746,13 @@ export interface ArtifactEventTarget { } export interface ArtifactChannel extends ArtifactEventTarget, Channel { _type_Artifact: boolean; - pathAfterFinished(params?: ArtifactPathAfterFinishedParams, progress?: Progress): Promise; - saveAs(params: ArtifactSaveAsParams, progress?: Progress): Promise; - saveAsStream(params?: ArtifactSaveAsStreamParams, progress?: Progress): Promise; - failure(params?: ArtifactFailureParams, progress?: Progress): Promise; - stream(params?: ArtifactStreamParams, progress?: Progress): Promise; - cancel(params?: ArtifactCancelParams, progress?: Progress): Promise; - delete(params?: ArtifactDeleteParams, progress?: Progress): Promise; + pathAfterFinished(params?: ArtifactPathAfterFinishedParams): Promise; + saveAs(params: ArtifactSaveAsParams): Promise; + saveAsStream(params?: ArtifactSaveAsStreamParams): Promise; + failure(params?: ArtifactFailureParams): Promise; + stream(params?: ArtifactStreamParams): Promise; + cancel(params?: ArtifactCancelParams): Promise; + delete(params?: ArtifactDeleteParams): Promise; } export type ArtifactPathAfterFinishedParams = {}; export type ArtifactPathAfterFinishedOptions = {}; @@ -801,8 +797,8 @@ export interface StreamEventTarget { } export interface StreamChannel extends StreamEventTarget, Channel { _type_Stream: boolean; - read(params: StreamReadParams, progress?: Progress): Promise; - close(params?: StreamCloseParams, progress?: Progress): Promise; + read(params: StreamReadParams): Promise; + close(params?: StreamCloseParams): Promise; } export type StreamReadParams = { size?: number, @@ -826,8 +822,8 @@ export interface WritableStreamEventTarget { } export interface WritableStreamChannel extends WritableStreamEventTarget, Channel { _type_WritableStream: boolean; - write(params: WritableStreamWriteParams, progress?: Progress): Promise; - close(params?: WritableStreamCloseParams, progress?: Progress): Promise; + write(params: WritableStreamWriteParams): Promise; + close(params?: WritableStreamCloseParams): Promise; } export type WritableStreamWriteParams = { binary: Binary, @@ -855,17 +851,17 @@ export interface BrowserEventTarget { } export interface BrowserChannel extends BrowserEventTarget, Channel { _type_Browser: boolean; - startServer(params: BrowserStartServerParams, progress?: Progress): Promise; - stopServer(params?: BrowserStopServerParams, progress?: Progress): Promise; - close(params: BrowserCloseParams, progress?: Progress): Promise; - killForTests(params?: BrowserKillForTestsParams, progress?: Progress): Promise; - defaultUserAgentForTest(params?: BrowserDefaultUserAgentForTestParams, progress?: Progress): Promise; - newContext(params: BrowserNewContextParams, progress?: Progress): Promise; - newContextForReuse(params: BrowserNewContextForReuseParams, progress?: Progress): Promise; - disconnectFromReusedContext(params: BrowserDisconnectFromReusedContextParams, progress?: Progress): Promise; - newBrowserCDPSession(params?: BrowserNewBrowserCDPSessionParams, progress?: Progress): Promise; - startTracing(params: BrowserStartTracingParams, progress?: Progress): Promise; - stopTracing(params?: BrowserStopTracingParams, progress?: Progress): Promise; + startServer(params: BrowserStartServerParams): Promise; + stopServer(params?: BrowserStopServerParams): Promise; + close(params: BrowserCloseParams): Promise; + killForTests(params?: BrowserKillForTestsParams): Promise; + defaultUserAgentForTest(params?: BrowserDefaultUserAgentForTestParams): Promise; + newContext(params: BrowserNewContextParams): Promise; + newContextForReuse(params: BrowserNewContextForReuseParams): Promise; + disconnectFromReusedContext(params: BrowserDisconnectFromReusedContextParams): Promise; + newBrowserCDPSession(params?: BrowserNewBrowserCDPSessionParams): Promise; + startTracing(params: BrowserStartTracingParams): Promise; + stopTracing(params?: BrowserStopTracingParams): Promise; } export type BrowserContextEvent = { context: BrowserContextChannel, @@ -1329,43 +1325,43 @@ export interface BrowserContextEventTarget { } export interface BrowserContextChannel extends BrowserContextEventTarget, Channel { _type_BrowserContext: boolean; - addCookies(params: BrowserContextAddCookiesParams, progress?: Progress): Promise; - addInitScript(params: BrowserContextAddInitScriptParams, progress?: Progress): Promise; - clearCookies(params: BrowserContextClearCookiesParams, progress?: Progress): Promise; - clearPermissions(params?: BrowserContextClearPermissionsParams, progress?: Progress): Promise; - close(params: BrowserContextCloseParams, progress?: Progress): Promise; - cookies(params: BrowserContextCookiesParams, progress?: Progress): Promise; - exposeBinding(params: BrowserContextExposeBindingParams, progress?: Progress): Promise; - grantPermissions(params: BrowserContextGrantPermissionsParams, progress?: Progress): Promise; - newPage(params?: BrowserContextNewPageParams, progress?: Progress): Promise; - registerSelectorEngine(params: BrowserContextRegisterSelectorEngineParams, progress?: Progress): Promise; - setTestIdAttributeName(params: BrowserContextSetTestIdAttributeNameParams, progress?: Progress): Promise; - setExtraHTTPHeaders(params: BrowserContextSetExtraHTTPHeadersParams, progress?: Progress): Promise; - setGeolocation(params: BrowserContextSetGeolocationParams, progress?: Progress): Promise; - setHTTPCredentials(params: BrowserContextSetHTTPCredentialsParams, progress?: Progress): Promise; - setNetworkInterceptionPatterns(params: BrowserContextSetNetworkInterceptionPatternsParams, progress?: Progress): Promise; - setWebSocketInterceptionPatterns(params: BrowserContextSetWebSocketInterceptionPatternsParams, progress?: Progress): Promise; - setOffline(params: BrowserContextSetOfflineParams, progress?: Progress): Promise; - storageState(params: BrowserContextStorageStateParams, progress?: Progress): Promise; - setStorageState(params: BrowserContextSetStorageStateParams, progress?: Progress): Promise; - pause(params?: BrowserContextPauseParams, progress?: Progress): Promise; - enableRecorder(params: BrowserContextEnableRecorderParams, progress?: Progress): Promise; - disableRecorder(params?: BrowserContextDisableRecorderParams, progress?: Progress): Promise; - exposeConsoleApi(params?: BrowserContextExposeConsoleApiParams, progress?: Progress): Promise; - newCDPSession(params: BrowserContextNewCDPSessionParams, progress?: Progress): Promise; - createTempFiles(params: BrowserContextCreateTempFilesParams, progress?: Progress): Promise; - updateSubscription(params: BrowserContextUpdateSubscriptionParams, progress?: Progress): Promise; - clockFastForward(params: BrowserContextClockFastForwardParams, progress?: Progress): Promise; - clockInstall(params: BrowserContextClockInstallParams, progress?: Progress): Promise; - clockPauseAt(params: BrowserContextClockPauseAtParams, progress?: Progress): Promise; - clockResume(params?: BrowserContextClockResumeParams, progress?: Progress): Promise; - clockRunFor(params: BrowserContextClockRunForParams, progress?: Progress): Promise; - clockSetFixedTime(params: BrowserContextClockSetFixedTimeParams, progress?: Progress): Promise; - clockSetSystemTime(params: BrowserContextClockSetSystemTimeParams, progress?: Progress): Promise; - credentialsInstall(params?: BrowserContextCredentialsInstallParams, progress?: Progress): Promise; - credentialsCreate(params: BrowserContextCredentialsCreateParams, progress?: Progress): Promise; - credentialsGet(params: BrowserContextCredentialsGetParams, progress?: Progress): Promise; - credentialsDelete(params: BrowserContextCredentialsDeleteParams, progress?: Progress): Promise; + addCookies(params: BrowserContextAddCookiesParams): Promise; + addInitScript(params: BrowserContextAddInitScriptParams): Promise; + clearCookies(params: BrowserContextClearCookiesParams): Promise; + clearPermissions(params?: BrowserContextClearPermissionsParams): Promise; + close(params: BrowserContextCloseParams): Promise; + cookies(params: BrowserContextCookiesParams): Promise; + exposeBinding(params: BrowserContextExposeBindingParams): Promise; + grantPermissions(params: BrowserContextGrantPermissionsParams): Promise; + newPage(params?: BrowserContextNewPageParams): Promise; + registerSelectorEngine(params: BrowserContextRegisterSelectorEngineParams): Promise; + setTestIdAttributeName(params: BrowserContextSetTestIdAttributeNameParams): Promise; + setExtraHTTPHeaders(params: BrowserContextSetExtraHTTPHeadersParams): Promise; + setGeolocation(params: BrowserContextSetGeolocationParams): Promise; + setHTTPCredentials(params: BrowserContextSetHTTPCredentialsParams): Promise; + setNetworkInterceptionPatterns(params: BrowserContextSetNetworkInterceptionPatternsParams): Promise; + setWebSocketInterceptionPatterns(params: BrowserContextSetWebSocketInterceptionPatternsParams): Promise; + setOffline(params: BrowserContextSetOfflineParams): Promise; + storageState(params: BrowserContextStorageStateParams): Promise; + setStorageState(params: BrowserContextSetStorageStateParams): Promise; + pause(params?: BrowserContextPauseParams): Promise; + enableRecorder(params: BrowserContextEnableRecorderParams): Promise; + disableRecorder(params?: BrowserContextDisableRecorderParams): Promise; + exposeConsoleApi(params?: BrowserContextExposeConsoleApiParams): Promise; + newCDPSession(params: BrowserContextNewCDPSessionParams): Promise; + createTempFiles(params: BrowserContextCreateTempFilesParams): Promise; + updateSubscription(params: BrowserContextUpdateSubscriptionParams): Promise; + clockFastForward(params: BrowserContextClockFastForwardParams): Promise; + clockInstall(params: BrowserContextClockInstallParams): Promise; + clockPauseAt(params: BrowserContextClockPauseAtParams): Promise; + clockResume(params?: BrowserContextClockResumeParams): Promise; + clockRunFor(params: BrowserContextClockRunForParams): Promise; + clockSetFixedTime(params: BrowserContextClockSetFixedTimeParams): Promise; + clockSetSystemTime(params: BrowserContextClockSetSystemTimeParams): Promise; + credentialsInstall(params?: BrowserContextCredentialsInstallParams): Promise; + credentialsCreate(params: BrowserContextCredentialsCreateParams): Promise; + credentialsGet(params: BrowserContextCredentialsGetParams): Promise; + credentialsDelete(params: BrowserContextCredentialsDeleteParams): Promise; } export type BrowserContextBindingCallEvent = { binding: BindingCallChannel, @@ -1811,10 +1807,10 @@ export interface BrowserTypeEventTarget { } export interface BrowserTypeChannel extends BrowserTypeEventTarget, Channel { _type_BrowserType: boolean; - launch(params: BrowserTypeLaunchParams, progress?: Progress): Promise; - launchPersistentContext(params: BrowserTypeLaunchPersistentContextParams, progress?: Progress): Promise; - connectOverCDP(params: BrowserTypeConnectOverCDPParams, progress?: Progress): Promise; - connectToWorker(params: BrowserTypeConnectToWorkerParams, progress?: Progress): Promise; + launch(params: BrowserTypeLaunchParams): Promise; + launchPersistentContext(params: BrowserTypeLaunchPersistentContextParams): Promise; + connectOverCDP(params: BrowserTypeConnectOverCDPParams): Promise; + connectToWorker(params: BrowserTypeConnectToWorkerParams): Promise; } export type BrowserTypeLaunchParams = { channel?: string, @@ -2110,7 +2106,7 @@ export interface DisposableEventTarget { } export interface DisposableChannel extends DisposableEventTarget, Channel { _type_Disposable: boolean; - dispose(params?: DisposableDisposeParams, progress?: Progress): Promise; + dispose(params?: DisposableDisposeParams): Promise; } export type DisposableDisposeParams = {}; export type DisposableDisposeOptions = {}; @@ -2133,7 +2129,7 @@ export interface ElectronEventTarget { } export interface ElectronChannel extends ElectronEventTarget, Channel { _type_Electron: boolean; - launch(params: ElectronLaunchParams, progress?: Progress): Promise; + launch(params: ElectronLaunchParams): Promise; } export type ElectronLaunchParams = { executablePath?: string, @@ -2239,10 +2235,10 @@ export interface ElectronApplicationEventTarget { } export interface ElectronApplicationChannel extends ElectronApplicationEventTarget, Channel { _type_ElectronApplication: boolean; - browserWindow(params: ElectronApplicationBrowserWindowParams, progress?: Progress): Promise; - evaluateExpression(params: ElectronApplicationEvaluateExpressionParams, progress?: Progress): Promise; - evaluateExpressionHandle(params: ElectronApplicationEvaluateExpressionHandleParams, progress?: Progress): Promise; - updateSubscription(params: ElectronApplicationUpdateSubscriptionParams, progress?: Progress): Promise; + browserWindow(params: ElectronApplicationBrowserWindowParams): Promise; + evaluateExpression(params: ElectronApplicationEvaluateExpressionParams): Promise; + evaluateExpressionHandle(params: ElectronApplicationEvaluateExpressionHandleParams): Promise; + updateSubscription(params: ElectronApplicationUpdateSubscriptionParams): Promise; } export type ElectronApplicationCloseEvent = {}; export type ElectronApplicationConsoleEvent = { @@ -2314,55 +2310,55 @@ export interface FrameEventTarget { } export interface FrameChannel extends FrameEventTarget, Channel { _type_Frame: boolean; - evalOnSelector(params: FrameEvalOnSelectorParams, progress?: Progress): Promise; - evalOnSelectorAll(params: FrameEvalOnSelectorAllParams, progress?: Progress): Promise; - addScriptTag(params: FrameAddScriptTagParams, progress?: Progress): Promise; - addStyleTag(params: FrameAddStyleTagParams, progress?: Progress): Promise; - ariaSnapshot(params: FrameAriaSnapshotParams, progress?: Progress): Promise; - blur(params: FrameBlurParams, progress?: Progress): Promise; - check(params: FrameCheckParams, progress?: Progress): Promise; - click(params: FrameClickParams, progress?: Progress): Promise; - content(params?: FrameContentParams, progress?: Progress): Promise; - dragAndDrop(params: FrameDragAndDropParams, progress?: Progress): Promise; - drop(params: FrameDropParams, progress?: Progress): Promise; - dblclick(params: FrameDblclickParams, progress?: Progress): Promise; - dispatchEvent(params: FrameDispatchEventParams, progress?: Progress): Promise; - evaluateExpression(params: FrameEvaluateExpressionParams, progress?: Progress): Promise; - evaluateExpressionHandle(params: FrameEvaluateExpressionHandleParams, progress?: Progress): Promise; - fill(params: FrameFillParams, progress?: Progress): Promise; - focus(params: FrameFocusParams, progress?: Progress): Promise; - frameElement(params?: FrameFrameElementParams, progress?: Progress): Promise; - resolveSelector(params: FrameResolveSelectorParams, progress?: Progress): Promise; - highlight(params: FrameHighlightParams, progress?: Progress): Promise; - hideHighlight(params: FrameHideHighlightParams, progress?: Progress): Promise; - getAttribute(params: FrameGetAttributeParams, progress?: Progress): Promise; - goto(params: FrameGotoParams, progress?: Progress): Promise; - hover(params: FrameHoverParams, progress?: Progress): Promise; - innerHTML(params: FrameInnerHTMLParams, progress?: Progress): Promise; - innerText(params: FrameInnerTextParams, progress?: Progress): Promise; - inputValue(params: FrameInputValueParams, progress?: Progress): Promise; - isChecked(params: FrameIsCheckedParams, progress?: Progress): Promise; - isDisabled(params: FrameIsDisabledParams, progress?: Progress): Promise; - isEnabled(params: FrameIsEnabledParams, progress?: Progress): Promise; - isHidden(params: FrameIsHiddenParams, progress?: Progress): Promise; - isVisible(params: FrameIsVisibleParams, progress?: Progress): Promise; - isEditable(params: FrameIsEditableParams, progress?: Progress): Promise; - press(params: FramePressParams, progress?: Progress): Promise; - querySelector(params: FrameQuerySelectorParams, progress?: Progress): Promise; - querySelectorAll(params: FrameQuerySelectorAllParams, progress?: Progress): Promise; - queryCount(params: FrameQueryCountParams, progress?: Progress): Promise; - selectOption(params: FrameSelectOptionParams, progress?: Progress): Promise; - setContent(params: FrameSetContentParams, progress?: Progress): Promise; - setInputFiles(params: FrameSetInputFilesParams, progress?: Progress): Promise; - tap(params: FrameTapParams, progress?: Progress): Promise; - textContent(params: FrameTextContentParams, progress?: Progress): Promise; - title(params?: FrameTitleParams, progress?: Progress): Promise; - type(params: FrameTypeParams, progress?: Progress): Promise; - uncheck(params: FrameUncheckParams, progress?: Progress): Promise; - waitForTimeout(params: FrameWaitForTimeoutParams, progress?: Progress): Promise; - waitForFunction(params: FrameWaitForFunctionParams, progress?: Progress): Promise; - waitForSelector(params: FrameWaitForSelectorParams, progress?: Progress): Promise; - expect(params: FrameExpectParams, progress?: Progress): Promise; + evalOnSelector(params: FrameEvalOnSelectorParams): Promise; + evalOnSelectorAll(params: FrameEvalOnSelectorAllParams): Promise; + addScriptTag(params: FrameAddScriptTagParams): Promise; + addStyleTag(params: FrameAddStyleTagParams): Promise; + ariaSnapshot(params: FrameAriaSnapshotParams): Promise; + blur(params: FrameBlurParams): Promise; + check(params: FrameCheckParams): Promise; + click(params: FrameClickParams): Promise; + content(params?: FrameContentParams): Promise; + dragAndDrop(params: FrameDragAndDropParams): Promise; + drop(params: FrameDropParams): Promise; + dblclick(params: FrameDblclickParams): Promise; + dispatchEvent(params: FrameDispatchEventParams): Promise; + evaluateExpression(params: FrameEvaluateExpressionParams): Promise; + evaluateExpressionHandle(params: FrameEvaluateExpressionHandleParams): Promise; + fill(params: FrameFillParams): Promise; + focus(params: FrameFocusParams): Promise; + frameElement(params?: FrameFrameElementParams): Promise; + resolveSelector(params: FrameResolveSelectorParams): Promise; + highlight(params: FrameHighlightParams): Promise; + hideHighlight(params: FrameHideHighlightParams): Promise; + getAttribute(params: FrameGetAttributeParams): Promise; + goto(params: FrameGotoParams): Promise; + hover(params: FrameHoverParams): Promise; + innerHTML(params: FrameInnerHTMLParams): Promise; + innerText(params: FrameInnerTextParams): Promise; + inputValue(params: FrameInputValueParams): Promise; + isChecked(params: FrameIsCheckedParams): Promise; + isDisabled(params: FrameIsDisabledParams): Promise; + isEnabled(params: FrameIsEnabledParams): Promise; + isHidden(params: FrameIsHiddenParams): Promise; + isVisible(params: FrameIsVisibleParams): Promise; + isEditable(params: FrameIsEditableParams): Promise; + press(params: FramePressParams): Promise; + querySelector(params: FrameQuerySelectorParams): Promise; + querySelectorAll(params: FrameQuerySelectorAllParams): Promise; + queryCount(params: FrameQueryCountParams): Promise; + selectOption(params: FrameSelectOptionParams): Promise; + setContent(params: FrameSetContentParams): Promise; + setInputFiles(params: FrameSetInputFilesParams): Promise; + tap(params: FrameTapParams): Promise; + textContent(params: FrameTextContentParams): Promise; + title(params?: FrameTitleParams): Promise; + type(params: FrameTypeParams): Promise; + uncheck(params: FrameUncheckParams): Promise; + waitForTimeout(params: FrameWaitForTimeoutParams): Promise; + waitForFunction(params: FrameWaitForFunctionParams): Promise; + waitForSelector(params: FrameWaitForSelectorParams): Promise; + expect(params: FrameExpectParams): Promise; } export type FrameLoadstateEvent = { add?: LifecycleEvent, @@ -3044,12 +3040,12 @@ export interface JSHandleEventTarget { } export interface JSHandleChannel extends JSHandleEventTarget, Channel { _type_JSHandle: boolean; - dispose(params?: JSHandleDisposeParams, progress?: Progress): Promise; - evaluateExpression(params: JSHandleEvaluateExpressionParams, progress?: Progress): Promise; - evaluateExpressionHandle(params: JSHandleEvaluateExpressionHandleParams, progress?: Progress): Promise; - getPropertyList(params?: JSHandleGetPropertyListParams, progress?: Progress): Promise; - getProperty(params: JSHandleGetPropertyParams, progress?: Progress): Promise; - jsonValue(params?: JSHandleJsonValueParams, progress?: Progress): Promise; + dispose(params?: JSHandleDisposeParams): Promise; + evaluateExpression(params: JSHandleEvaluateExpressionParams): Promise; + evaluateExpressionHandle(params: JSHandleEvaluateExpressionHandleParams): Promise; + getPropertyList(params?: JSHandleGetPropertyListParams): Promise; + getProperty(params: JSHandleGetPropertyParams): Promise; + jsonValue(params?: JSHandleJsonValueParams): Promise; } export type JSHandlePreviewUpdatedEvent = { preview: string, @@ -3112,42 +3108,42 @@ export interface ElementHandleEventTarget { } export interface ElementHandleChannel extends ElementHandleEventTarget, JSHandleChannel { _type_ElementHandle: boolean; - evalOnSelector(params: ElementHandleEvalOnSelectorParams, progress?: Progress): Promise; - evalOnSelectorAll(params: ElementHandleEvalOnSelectorAllParams, progress?: Progress): Promise; - boundingBox(params?: ElementHandleBoundingBoxParams, progress?: Progress): Promise; - check(params: ElementHandleCheckParams, progress?: Progress): Promise; - click(params: ElementHandleClickParams, progress?: Progress): Promise; - contentFrame(params?: ElementHandleContentFrameParams, progress?: Progress): Promise; - dblclick(params: ElementHandleDblclickParams, progress?: Progress): Promise; - dispatchEvent(params: ElementHandleDispatchEventParams, progress?: Progress): Promise; - fill(params: ElementHandleFillParams, progress?: Progress): Promise; - focus(params?: ElementHandleFocusParams, progress?: Progress): Promise; - getAttribute(params: ElementHandleGetAttributeParams, progress?: Progress): Promise; - hover(params: ElementHandleHoverParams, progress?: Progress): Promise; - innerHTML(params?: ElementHandleInnerHTMLParams, progress?: Progress): Promise; - innerText(params?: ElementHandleInnerTextParams, progress?: Progress): Promise; - inputValue(params?: ElementHandleInputValueParams, progress?: Progress): Promise; - isChecked(params?: ElementHandleIsCheckedParams, progress?: Progress): Promise; - isDisabled(params?: ElementHandleIsDisabledParams, progress?: Progress): Promise; - isEditable(params?: ElementHandleIsEditableParams, progress?: Progress): Promise; - isEnabled(params?: ElementHandleIsEnabledParams, progress?: Progress): Promise; - isHidden(params?: ElementHandleIsHiddenParams, progress?: Progress): Promise; - isVisible(params?: ElementHandleIsVisibleParams, progress?: Progress): Promise; - ownerFrame(params?: ElementHandleOwnerFrameParams, progress?: Progress): Promise; - press(params: ElementHandlePressParams, progress?: Progress): Promise; - querySelector(params: ElementHandleQuerySelectorParams, progress?: Progress): Promise; - querySelectorAll(params: ElementHandleQuerySelectorAllParams, progress?: Progress): Promise; - screenshot(params: ElementHandleScreenshotParams, progress?: Progress): Promise; - scrollIntoViewIfNeeded(params: ElementHandleScrollIntoViewIfNeededParams, progress?: Progress): Promise; - selectOption(params: ElementHandleSelectOptionParams, progress?: Progress): Promise; - selectText(params: ElementHandleSelectTextParams, progress?: Progress): Promise; - setInputFiles(params: ElementHandleSetInputFilesParams, progress?: Progress): Promise; - tap(params: ElementHandleTapParams, progress?: Progress): Promise; - textContent(params?: ElementHandleTextContentParams, progress?: Progress): Promise; - type(params: ElementHandleTypeParams, progress?: Progress): Promise; - uncheck(params: ElementHandleUncheckParams, progress?: Progress): Promise; - waitForElementState(params: ElementHandleWaitForElementStateParams, progress?: Progress): Promise; - waitForSelector(params: ElementHandleWaitForSelectorParams, progress?: Progress): Promise; + evalOnSelector(params: ElementHandleEvalOnSelectorParams): Promise; + evalOnSelectorAll(params: ElementHandleEvalOnSelectorAllParams): Promise; + boundingBox(params?: ElementHandleBoundingBoxParams): Promise; + check(params: ElementHandleCheckParams): Promise; + click(params: ElementHandleClickParams): Promise; + contentFrame(params?: ElementHandleContentFrameParams): Promise; + dblclick(params: ElementHandleDblclickParams): Promise; + dispatchEvent(params: ElementHandleDispatchEventParams): Promise; + fill(params: ElementHandleFillParams): Promise; + focus(params?: ElementHandleFocusParams): Promise; + getAttribute(params: ElementHandleGetAttributeParams): Promise; + hover(params: ElementHandleHoverParams): Promise; + innerHTML(params?: ElementHandleInnerHTMLParams): Promise; + innerText(params?: ElementHandleInnerTextParams): Promise; + inputValue(params?: ElementHandleInputValueParams): Promise; + isChecked(params?: ElementHandleIsCheckedParams): Promise; + isDisabled(params?: ElementHandleIsDisabledParams): Promise; + isEditable(params?: ElementHandleIsEditableParams): Promise; + isEnabled(params?: ElementHandleIsEnabledParams): Promise; + isHidden(params?: ElementHandleIsHiddenParams): Promise; + isVisible(params?: ElementHandleIsVisibleParams): Promise; + ownerFrame(params?: ElementHandleOwnerFrameParams): Promise; + press(params: ElementHandlePressParams): Promise; + querySelector(params: ElementHandleQuerySelectorParams): Promise; + querySelectorAll(params: ElementHandleQuerySelectorAllParams): Promise; + screenshot(params: ElementHandleScreenshotParams): Promise; + scrollIntoViewIfNeeded(params: ElementHandleScrollIntoViewIfNeededParams): Promise; + selectOption(params: ElementHandleSelectOptionParams): Promise; + selectText(params: ElementHandleSelectTextParams): Promise; + setInputFiles(params: ElementHandleSetInputFilesParams): Promise; + tap(params: ElementHandleTapParams): Promise; + textContent(params?: ElementHandleTextContentParams): Promise; + type(params: ElementHandleTypeParams): Promise; + uncheck(params: ElementHandleUncheckParams): Promise; + waitForElementState(params: ElementHandleWaitForElementStateParams): Promise; + waitForSelector(params: ElementHandleWaitForSelectorParams): Promise; } export type ElementHandleEvalOnSelectorParams = { selector: string, @@ -3549,16 +3545,16 @@ export interface LocalUtilsEventTarget { } export interface LocalUtilsChannel extends LocalUtilsEventTarget, Channel { _type_LocalUtils: boolean; - zip(params: LocalUtilsZipParams, progress?: Progress): Promise; - harOpen(params: LocalUtilsHarOpenParams, progress?: Progress): Promise; - harLookup(params: LocalUtilsHarLookupParams, progress?: Progress): Promise; - harClose(params: LocalUtilsHarCloseParams, progress?: Progress): Promise; - harUnzip(params: LocalUtilsHarUnzipParams, progress?: Progress): Promise; - connect(params: LocalUtilsConnectParams, progress?: Progress): Promise; - tracingStarted(params: LocalUtilsTracingStartedParams, progress?: Progress): Promise; - addStackToTracingNoReply(params: LocalUtilsAddStackToTracingNoReplyParams, progress?: Progress): Promise; - traceDiscarded(params: LocalUtilsTraceDiscardedParams, progress?: Progress): Promise; - globToRegex(params: LocalUtilsGlobToRegexParams, progress?: Progress): Promise; + zip(params: LocalUtilsZipParams): Promise; + harOpen(params: LocalUtilsHarOpenParams): Promise; + harLookup(params: LocalUtilsHarLookupParams): Promise; + harClose(params: LocalUtilsHarCloseParams): Promise; + harUnzip(params: LocalUtilsHarUnzipParams): Promise; + connect(params: LocalUtilsConnectParams): Promise; + tracingStarted(params: LocalUtilsTracingStartedParams): Promise; + addStackToTracingNoReply(params: LocalUtilsAddStackToTracingNoReplyParams): Promise; + traceDiscarded(params: LocalUtilsTraceDiscardedParams): Promise; + globToRegex(params: LocalUtilsGlobToRegexParams): Promise; } export type LocalUtilsZipParams = { zipFile: string, @@ -3721,8 +3717,8 @@ export interface RequestEventTarget { } export interface RequestChannel extends RequestEventTarget, Channel { _type_Request: boolean; - response(params?: RequestResponseParams, progress?: Progress): Promise; - rawRequestHeaders(params?: RequestRawRequestHeadersParams, progress?: Progress): Promise; + response(params?: RequestResponseParams): Promise; + rawRequestHeaders(params?: RequestRawRequestHeadersParams): Promise; } export type RequestResponseParams = {}; export type RequestResponseOptions = {}; @@ -3746,10 +3742,10 @@ export interface RouteEventTarget { } export interface RouteChannel extends RouteEventTarget, Channel { _type_Route: boolean; - redirectNavigationRequest(params: RouteRedirectNavigationRequestParams, progress?: Progress): Promise; - abort(params: RouteAbortParams, progress?: Progress): Promise; - continue(params: RouteContinueParams, progress?: Progress): Promise; - fulfill(params: RouteFulfillParams, progress?: Progress): Promise; + redirectNavigationRequest(params: RouteRedirectNavigationRequestParams): Promise; + abort(params: RouteAbortParams): Promise; + continue(params: RouteContinueParams): Promise; + fulfill(params: RouteFulfillParams): Promise; } export type RouteRedirectNavigationRequestParams = { url: string, @@ -3811,12 +3807,12 @@ export interface WebSocketRouteEventTarget { } export interface WebSocketRouteChannel extends WebSocketRouteEventTarget, Channel { _type_WebSocketRoute: boolean; - connect(params?: WebSocketRouteConnectParams, progress?: Progress): Promise; - ensureOpened(params?: WebSocketRouteEnsureOpenedParams, progress?: Progress): Promise; - sendToPage(params: WebSocketRouteSendToPageParams, progress?: Progress): Promise; - sendToServer(params: WebSocketRouteSendToServerParams, progress?: Progress): Promise; - closePage(params: WebSocketRouteClosePageParams, progress?: Progress): Promise; - closeServer(params: WebSocketRouteCloseServerParams, progress?: Progress): Promise; + connect(params?: WebSocketRouteConnectParams): Promise; + ensureOpened(params?: WebSocketRouteEnsureOpenedParams): Promise; + sendToPage(params: WebSocketRouteSendToPageParams): Promise; + sendToServer(params: WebSocketRouteSendToServerParams): Promise; + closePage(params: WebSocketRouteClosePageParams): Promise; + closeServer(params: WebSocketRouteCloseServerParams): Promise; } export type WebSocketRouteMessageFromPageEvent = { message: string, @@ -3911,12 +3907,12 @@ export interface ResponseEventTarget { } export interface ResponseChannel extends ResponseEventTarget, Channel { _type_Response: boolean; - body(params?: ResponseBodyParams, progress?: Progress): Promise; - securityDetails(params?: ResponseSecurityDetailsParams, progress?: Progress): Promise; - serverAddr(params?: ResponseServerAddrParams, progress?: Progress): Promise; - rawResponseHeaders(params?: ResponseRawResponseHeadersParams, progress?: Progress): Promise; - httpVersion(params?: ResponseHttpVersionParams, progress?: Progress): Promise; - sizes(params?: ResponseSizesParams, progress?: Progress): Promise; + body(params?: ResponseBodyParams): Promise; + securityDetails(params?: ResponseSecurityDetailsParams): Promise; + serverAddr(params?: ResponseServerAddrParams): Promise; + rawResponseHeaders(params?: ResponseRawResponseHeadersParams): Promise; + httpVersion(params?: ResponseHttpVersionParams): Promise; + sizes(params?: ResponseSizesParams): Promise; } export type ResponseBodyParams = {}; export type ResponseBodyOptions = {}; @@ -4037,64 +4033,64 @@ export interface PageEventTarget { } export interface PageChannel extends PageEventTarget, Channel { _type_Page: boolean; - addInitScript(params: PageAddInitScriptParams, progress?: Progress): Promise; - close(params: PageCloseParams, progress?: Progress): Promise; - runBeforeUnload(params?: PageRunBeforeUnloadParams, progress?: Progress): Promise; - clearConsoleMessages(params?: PageClearConsoleMessagesParams, progress?: Progress): Promise; - consoleMessages(params: PageConsoleMessagesParams, progress?: Progress): Promise; - emulateMedia(params: PageEmulateMediaParams, progress?: Progress): Promise; - exposeBinding(params: PageExposeBindingParams, progress?: Progress): Promise; - goBack(params: PageGoBackParams, progress?: Progress): Promise; - goForward(params: PageGoForwardParams, progress?: Progress): Promise; - requestGC(params?: PageRequestGCParams, progress?: Progress): Promise; - registerLocatorHandler(params: PageRegisterLocatorHandlerParams, progress?: Progress): Promise; - resolveLocatorHandlerNoReply(params: PageResolveLocatorHandlerNoReplyParams, progress?: Progress): Promise; - unregisterLocatorHandler(params: PageUnregisterLocatorHandlerParams, progress?: Progress): Promise; - reload(params: PageReloadParams, progress?: Progress): Promise; - expectScreenshot(params: PageExpectScreenshotParams, progress?: Progress): Promise; - screenshot(params: PageScreenshotParams, progress?: Progress): Promise; - setExtraHTTPHeaders(params: PageSetExtraHTTPHeadersParams, progress?: Progress): Promise; - setNetworkInterceptionPatterns(params: PageSetNetworkInterceptionPatternsParams, progress?: Progress): Promise; - setWebSocketInterceptionPatterns(params: PageSetWebSocketInterceptionPatternsParams, progress?: Progress): Promise; - setViewportSize(params: PageSetViewportSizeParams, progress?: Progress): Promise; - keyboardDown(params: PageKeyboardDownParams, progress?: Progress): Promise; - keyboardUp(params: PageKeyboardUpParams, progress?: Progress): Promise; - keyboardInsertText(params: PageKeyboardInsertTextParams, progress?: Progress): Promise; - keyboardType(params: PageKeyboardTypeParams, progress?: Progress): Promise; - keyboardPress(params: PageKeyboardPressParams, progress?: Progress): Promise; - mouseMove(params: PageMouseMoveParams, progress?: Progress): Promise; - mouseDown(params: PageMouseDownParams, progress?: Progress): Promise; - mouseUp(params: PageMouseUpParams, progress?: Progress): Promise; - mouseClick(params: PageMouseClickParams, progress?: Progress): Promise; - mouseWheel(params: PageMouseWheelParams, progress?: Progress): Promise; - touchscreenTap(params: PageTouchscreenTapParams, progress?: Progress): Promise; - clearPageErrors(params?: PageClearPageErrorsParams, progress?: Progress): Promise; - pageErrors(params: PagePageErrorsParams, progress?: Progress): Promise; - pdf(params: PagePdfParams, progress?: Progress): Promise; - requests(params?: PageRequestsParams, progress?: Progress): Promise; - startJSCoverage(params: PageStartJSCoverageParams, progress?: Progress): Promise; - stopJSCoverage(params?: PageStopJSCoverageParams, progress?: Progress): Promise; - startCSSCoverage(params: PageStartCSSCoverageParams, progress?: Progress): Promise; - stopCSSCoverage(params?: PageStopCSSCoverageParams, progress?: Progress): Promise; - bringToFront(params?: PageBringToFrontParams, progress?: Progress): Promise; - pickLocator(params?: PagePickLocatorParams, progress?: Progress): Promise; - cancelPickLocator(params?: PageCancelPickLocatorParams, progress?: Progress): Promise; - hideHighlight(params?: PageHideHighlightParams, progress?: Progress): Promise; - screencastShowOverlay(params: PageScreencastShowOverlayParams, progress?: Progress): Promise; - screencastRemoveOverlay(params: PageScreencastRemoveOverlayParams, progress?: Progress): Promise; - screencastChapter(params: PageScreencastChapterParams, progress?: Progress): Promise; - screencastSetOverlayVisible(params: PageScreencastSetOverlayVisibleParams, progress?: Progress): Promise; - screencastShowActions(params: PageScreencastShowActionsParams, progress?: Progress): Promise; - screencastHideActions(params?: PageScreencastHideActionsParams, progress?: Progress): Promise; - screencastStart(params: PageScreencastStartParams, progress?: Progress): Promise; - screencastStop(params?: PageScreencastStopParams, progress?: Progress): Promise; - updateSubscription(params: PageUpdateSubscriptionParams, progress?: Progress): Promise; - setDockTile(params: PageSetDockTileParams, progress?: Progress): Promise; - webStorageItems(params: PageWebStorageItemsParams, progress?: Progress): Promise; - webStorageGetItem(params: PageWebStorageGetItemParams, progress?: Progress): Promise; - webStorageSetItem(params: PageWebStorageSetItemParams, progress?: Progress): Promise; - webStorageRemoveItem(params: PageWebStorageRemoveItemParams, progress?: Progress): Promise; - webStorageClear(params: PageWebStorageClearParams, progress?: Progress): Promise; + addInitScript(params: PageAddInitScriptParams): Promise; + close(params: PageCloseParams): Promise; + runBeforeUnload(params?: PageRunBeforeUnloadParams): Promise; + clearConsoleMessages(params?: PageClearConsoleMessagesParams): Promise; + consoleMessages(params: PageConsoleMessagesParams): Promise; + emulateMedia(params: PageEmulateMediaParams): Promise; + exposeBinding(params: PageExposeBindingParams): Promise; + goBack(params: PageGoBackParams): Promise; + goForward(params: PageGoForwardParams): Promise; + requestGC(params?: PageRequestGCParams): Promise; + registerLocatorHandler(params: PageRegisterLocatorHandlerParams): Promise; + resolveLocatorHandlerNoReply(params: PageResolveLocatorHandlerNoReplyParams): Promise; + unregisterLocatorHandler(params: PageUnregisterLocatorHandlerParams): Promise; + reload(params: PageReloadParams): Promise; + expectScreenshot(params: PageExpectScreenshotParams): Promise; + screenshot(params: PageScreenshotParams): Promise; + setExtraHTTPHeaders(params: PageSetExtraHTTPHeadersParams): Promise; + setNetworkInterceptionPatterns(params: PageSetNetworkInterceptionPatternsParams): Promise; + setWebSocketInterceptionPatterns(params: PageSetWebSocketInterceptionPatternsParams): Promise; + setViewportSize(params: PageSetViewportSizeParams): Promise; + keyboardDown(params: PageKeyboardDownParams): Promise; + keyboardUp(params: PageKeyboardUpParams): Promise; + keyboardInsertText(params: PageKeyboardInsertTextParams): Promise; + keyboardType(params: PageKeyboardTypeParams): Promise; + keyboardPress(params: PageKeyboardPressParams): Promise; + mouseMove(params: PageMouseMoveParams): Promise; + mouseDown(params: PageMouseDownParams): Promise; + mouseUp(params: PageMouseUpParams): Promise; + mouseClick(params: PageMouseClickParams): Promise; + mouseWheel(params: PageMouseWheelParams): Promise; + touchscreenTap(params: PageTouchscreenTapParams): Promise; + clearPageErrors(params?: PageClearPageErrorsParams): Promise; + pageErrors(params: PagePageErrorsParams): Promise; + pdf(params: PagePdfParams): Promise; + requests(params?: PageRequestsParams): Promise; + startJSCoverage(params: PageStartJSCoverageParams): Promise; + stopJSCoverage(params?: PageStopJSCoverageParams): Promise; + startCSSCoverage(params: PageStartCSSCoverageParams): Promise; + stopCSSCoverage(params?: PageStopCSSCoverageParams): Promise; + bringToFront(params?: PageBringToFrontParams): Promise; + pickLocator(params?: PagePickLocatorParams): Promise; + cancelPickLocator(params?: PageCancelPickLocatorParams): Promise; + hideHighlight(params?: PageHideHighlightParams): Promise; + screencastShowOverlay(params: PageScreencastShowOverlayParams): Promise; + screencastRemoveOverlay(params: PageScreencastRemoveOverlayParams): Promise; + screencastChapter(params: PageScreencastChapterParams): Promise; + screencastSetOverlayVisible(params: PageScreencastSetOverlayVisibleParams): Promise; + screencastShowActions(params: PageScreencastShowActionsParams): Promise; + screencastHideActions(params?: PageScreencastHideActionsParams): Promise; + screencastStart(params: PageScreencastStartParams): Promise; + screencastStop(params?: PageScreencastStopParams): Promise; + updateSubscription(params: PageUpdateSubscriptionParams): Promise; + setDockTile(params: PageSetDockTileParams): Promise; + webStorageItems(params: PageWebStorageItemsParams): Promise; + webStorageGetItem(params: PageWebStorageGetItemParams): Promise; + webStorageSetItem(params: PageWebStorageSetItemParams): Promise; + webStorageRemoveItem(params: PageWebStorageRemoveItemParams): Promise; + webStorageClear(params: PageWebStorageClearParams): Promise; } export type PageBindingCallEvent = { binding: BindingCallChannel, @@ -4773,7 +4769,7 @@ export interface RootEventTarget { } export interface RootChannel extends RootEventTarget, Channel { _type_Root: boolean; - initialize(params: RootInitializeParams, progress?: Progress): Promise; + initialize(params: RootInitializeParams): Promise; } export type RootInitializeParams = { sdkLanguage: SDKLanguage, @@ -4804,7 +4800,7 @@ export interface PlaywrightEventTarget { } export interface PlaywrightChannel extends PlaywrightEventTarget, Channel { _type_Playwright: boolean; - newRequest(params: PlaywrightNewRequestParams, progress?: Progress): Promise; + newRequest(params: PlaywrightNewRequestParams): Promise; } export type PlaywrightNewRequestParams = { baseURL?: string, @@ -4888,13 +4884,13 @@ export interface DebugControllerEventTarget { } export interface DebugControllerChannel extends DebugControllerEventTarget, Channel { _type_DebugController: boolean; - initialize(params: DebugControllerInitializeParams, progress?: Progress): Promise; - setReportStateChanged(params: DebugControllerSetReportStateChangedParams, progress?: Progress): Promise; - setRecorderMode(params: DebugControllerSetRecorderModeParams, progress?: Progress): Promise; - highlight(params: DebugControllerHighlightParams, progress?: Progress): Promise; - hideHighlight(params?: DebugControllerHideHighlightParams, progress?: Progress): Promise; - resume(params?: DebugControllerResumeParams, progress?: Progress): Promise; - kill(params?: DebugControllerKillParams, progress?: Progress): Promise; + initialize(params: DebugControllerInitializeParams): Promise; + setReportStateChanged(params: DebugControllerSetReportStateChangedParams): Promise; + setRecorderMode(params: DebugControllerSetRecorderModeParams): Promise; + highlight(params: DebugControllerHighlightParams): Promise; + hideHighlight(params?: DebugControllerHideHighlightParams): Promise; + resume(params?: DebugControllerResumeParams): Promise; + kill(params?: DebugControllerKillParams): Promise; } export type DebugControllerInspectRequestedEvent = { selector: string, @@ -4977,11 +4973,11 @@ export interface SocksSupportEventTarget { } export interface SocksSupportChannel extends SocksSupportEventTarget, Channel { _type_SocksSupport: boolean; - socksConnected(params: SocksSupportSocksConnectedParams, progress?: Progress): Promise; - socksFailed(params: SocksSupportSocksFailedParams, progress?: Progress): Promise; - socksData(params: SocksSupportSocksDataParams, progress?: Progress): Promise; - socksError(params: SocksSupportSocksErrorParams, progress?: Progress): Promise; - socksEnd(params: SocksSupportSocksEndParams, progress?: Progress): Promise; + socksConnected(params: SocksSupportSocksConnectedParams): Promise; + socksFailed(params: SocksSupportSocksFailedParams): Promise; + socksData(params: SocksSupportSocksDataParams): Promise; + socksError(params: SocksSupportSocksErrorParams): Promise; + socksEnd(params: SocksSupportSocksEndParams): Promise; } export type SocksSupportSocksRequestedEvent = { uid: string, @@ -5050,8 +5046,8 @@ export interface JsonPipeEventTarget { } export interface JsonPipeChannel extends JsonPipeEventTarget, Channel { _type_JsonPipe: boolean; - send(params: JsonPipeSendParams, progress?: Progress): Promise; - close(params?: JsonPipeCloseParams, progress?: Progress): Promise; + send(params: JsonPipeSendParams): Promise; + close(params?: JsonPipeCloseParams): Promise; } export type JsonPipeMessageEvent = { message: any, @@ -5170,8 +5166,8 @@ export interface CDPSessionEventTarget { } export interface CDPSessionChannel extends CDPSessionEventTarget, Channel { _type_CDPSession: boolean; - send(params: CDPSessionSendParams, progress?: Progress): Promise; - detach(params?: CDPSessionDetachParams, progress?: Progress): Promise; + send(params: CDPSessionSendParams): Promise; + detach(params?: CDPSessionDetachParams): Promise; } export type CDPSessionEventEvent = { method: string, @@ -5207,8 +5203,8 @@ export interface BindingCallEventTarget { } export interface BindingCallChannel extends BindingCallEventTarget, Channel { _type_BindingCall: boolean; - reject(params: BindingCallRejectParams, progress?: Progress): Promise; - resolve(params: BindingCallResolveParams, progress?: Progress): Promise; + reject(params: BindingCallRejectParams): Promise; + resolve(params: BindingCallResolveParams): Promise; } export type BindingCallRejectParams = { error: SerializedError, @@ -5235,10 +5231,10 @@ export interface DebuggerEventTarget { } export interface DebuggerChannel extends DebuggerEventTarget, Channel { _type_Debugger: boolean; - requestPause(params?: DebuggerRequestPauseParams, progress?: Progress): Promise; - resume(params?: DebuggerResumeParams, progress?: Progress): Promise; - next(params?: DebuggerNextParams, progress?: Progress): Promise; - runTo(params: DebuggerRunToParams, progress?: Progress): Promise; + requestPause(params?: DebuggerRequestPauseParams): Promise; + resume(params?: DebuggerResumeParams): Promise; + next(params?: DebuggerNextParams): Promise; + runTo(params: DebuggerRunToParams): Promise; } export type DebuggerPausedStateChangedEvent = { pausedDetails?: { @@ -5287,8 +5283,8 @@ export interface DialogEventTarget { } export interface DialogChannel extends DialogEventTarget, Channel { _type_Dialog: boolean; - accept(params: DialogAcceptParams, progress?: Progress): Promise; - dismiss(params?: DialogDismissParams, progress?: Progress): Promise; + accept(params: DialogAcceptParams): Promise; + dismiss(params?: DialogDismissParams): Promise; } export type DialogAcceptParams = { promptText?: string, @@ -5398,14 +5394,14 @@ export interface TracingEventTarget { } export interface TracingChannel extends TracingEventTarget, Channel { _type_Tracing: boolean; - tracingStart(params: TracingTracingStartParams, progress?: Progress): Promise; - tracingStartChunk(params: TracingTracingStartChunkParams, progress?: Progress): Promise; - tracingGroup(params: TracingTracingGroupParams, progress?: Progress): Promise; - tracingGroupEnd(params?: TracingTracingGroupEndParams, progress?: Progress): Promise; - tracingStopChunk(params: TracingTracingStopChunkParams, progress?: Progress): Promise; - tracingStop(params?: TracingTracingStopParams, progress?: Progress): Promise; - harStart(params: TracingHarStartParams, progress?: Progress): Promise; - harExport(params: TracingHarExportParams, progress?: Progress): Promise; + tracingStart(params: TracingTracingStartParams): Promise; + tracingStartChunk(params: TracingTracingStartChunkParams): Promise; + tracingGroup(params: TracingTracingGroupParams): Promise; + tracingGroupEnd(params?: TracingTracingGroupEndParams): Promise; + tracingStopChunk(params: TracingTracingStopChunkParams): Promise; + tracingStop(params?: TracingTracingStopParams): Promise; + harStart(params: TracingHarStartParams): Promise; + harExport(params: TracingHarExportParams): Promise; } export type TracingTracingStartParams = { name?: string, @@ -5498,10 +5494,10 @@ export interface WorkerEventTarget { } export interface WorkerChannel extends WorkerEventTarget, Channel { _type_Worker: boolean; - disconnect(params: WorkerDisconnectParams, progress?: Progress): Promise; - evaluateExpression(params: WorkerEvaluateExpressionParams, progress?: Progress): Promise; - evaluateExpressionHandle(params: WorkerEvaluateExpressionHandleParams, progress?: Progress): Promise; - updateSubscription(params: WorkerUpdateSubscriptionParams, progress?: Progress): Promise; + disconnect(params: WorkerDisconnectParams): Promise; + evaluateExpression(params: WorkerEvaluateExpressionParams): Promise; + evaluateExpressionHandle(params: WorkerEvaluateExpressionHandleParams): Promise; + updateSubscription(params: WorkerUpdateSubscriptionParams): Promise; } export type WorkerConsoleEvent = { type: string, diff --git a/packages/playwright-core/src/client/clientInstrumentation.ts b/packages/playwright-core/src/client/clientInstrumentation.ts index 670994cd6145b..098ca06abdee1 100644 --- a/packages/playwright-core/src/client/clientInstrumentation.ts +++ b/packages/playwright-core/src/client/clientInstrumentation.ts @@ -16,7 +16,7 @@ import type { BrowserContext } from './browserContext'; import type { APIRequestContext, NewContextOptions } from './fetch'; -import type { StackFrame } from '@protocol/channels'; +import type { StackFrame } from './channels'; import type { Page } from './page'; import type { BrowserContextOptions } from './types'; diff --git a/packages/playwright-core/src/client/connect.ts b/packages/playwright-core/src/client/connect.ts index ffd2da4d57c24..86836d4d3b9e4 100644 --- a/packages/playwright-core/src/client/connect.ts +++ b/packages/playwright-core/src/client/connect.ts @@ -23,7 +23,7 @@ import { Events } from './events'; import type { Playwright } from './playwright'; import type { ConnectOptions, HeadersArray } from './types'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; export async function connectToBrowser(playwright: Playwright, params: ConnectOptions): Promise { const deadline = params.timeout ? monotonicTime() + params.timeout : 0; diff --git a/packages/playwright-core/src/client/connection.ts b/packages/playwright-core/src/client/connection.ts index 01c04284bbf1f..41b6485e648d7 100644 --- a/packages/playwright-core/src/client/connection.ts +++ b/packages/playwright-core/src/client/connection.ts @@ -47,7 +47,7 @@ import type { ClientInstrumentation } from './clientInstrumentation'; import type { HeadersArray } from './types'; import type { ValidatorContext } from '../protocol/validator'; import type { Platform } from '@isomorphic/platform'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; class Root extends ChannelOwner { constructor(connection: Connection) { diff --git a/packages/playwright-core/src/client/consoleMessage.ts b/packages/playwright-core/src/client/consoleMessage.ts index 4b4e213293cdb..6c50bc8168436 100644 --- a/packages/playwright-core/src/client/consoleMessage.ts +++ b/packages/playwright-core/src/client/consoleMessage.ts @@ -18,7 +18,7 @@ import { JSHandle } from './jsHandle'; import type * as api from '../../types/types'; import type { Platform } from '@isomorphic/platform'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; import type { Page } from './page'; import type { Worker } from './worker'; diff --git a/packages/playwright-core/src/client/coverage.ts b/packages/playwright-core/src/client/coverage.ts index 7e1cb7ef2b650..5251ef9f652cb 100644 --- a/packages/playwright-core/src/client/coverage.ts +++ b/packages/playwright-core/src/client/coverage.ts @@ -15,7 +15,7 @@ */ import type * as api from '../../types/types'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; export class Coverage implements api.Coverage { private _channel: channels.PageChannel; diff --git a/packages/playwright-core/src/client/credentials.ts b/packages/playwright-core/src/client/credentials.ts index 973fdad7369ab..81b3d68986137 100644 --- a/packages/playwright-core/src/client/credentials.ts +++ b/packages/playwright-core/src/client/credentials.ts @@ -16,7 +16,7 @@ import type { BrowserContext } from './browserContext'; import type * as api from '../../types/types'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; export class Credentials implements api.Credentials { private _browserContext: BrowserContext; diff --git a/packages/playwright-core/src/client/debugger.ts b/packages/playwright-core/src/client/debugger.ts index b83427bdb0341..55fb8a6639af3 100644 --- a/packages/playwright-core/src/client/debugger.ts +++ b/packages/playwright-core/src/client/debugger.ts @@ -18,7 +18,7 @@ import { ChannelOwner } from './channelOwner'; import { Events } from './events'; import type * as api from '../../types/types'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; type PausedDetails = { location: { file: string, line?: number, column?: number }, title: string, stack?: string }; diff --git a/packages/playwright-core/src/client/dialog.ts b/packages/playwright-core/src/client/dialog.ts index 98a41291cc607..dd38c1ff6d288 100644 --- a/packages/playwright-core/src/client/dialog.ts +++ b/packages/playwright-core/src/client/dialog.ts @@ -19,7 +19,7 @@ import { Page } from './page'; import { isTargetClosedError } from './errors'; import type * as api from '../../types/types'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; export class Dialog extends ChannelOwner implements api.Dialog { diff --git a/packages/playwright-core/src/client/disposable.ts b/packages/playwright-core/src/client/disposable.ts index fc6b414d5ae01..129eae1b2cddb 100644 --- a/packages/playwright-core/src/client/disposable.ts +++ b/packages/playwright-core/src/client/disposable.ts @@ -17,7 +17,7 @@ import { ChannelOwner } from './channelOwner'; import { isTargetClosedError } from './errors'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; export interface Disposable { dispose: () => Promise; diff --git a/packages/playwright-core/src/client/electron.ts b/packages/playwright-core/src/client/electron.ts index f83be0294672f..a40923600932a 100644 --- a/packages/playwright-core/src/client/electron.ts +++ b/packages/playwright-core/src/client/electron.ts @@ -28,7 +28,7 @@ import type { Page } from './page'; import type { BrowserContextOptions, Headers, TimeoutOptions, WaitForEventOptions } from './types'; import type * as structs from '../../types/structs'; import type * as api from '../../types/types'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; import type * as childProcess from 'child_process'; import type { BrowserWindow } from 'electron'; import type { Playwright } from './playwright'; diff --git a/packages/playwright-core/src/client/elementHandle.ts b/packages/playwright-core/src/client/elementHandle.ts index 99e3c555d9411..afaf107a6f2e8 100644 --- a/packages/playwright-core/src/client/elementHandle.ts +++ b/packages/playwright-core/src/client/elementHandle.ts @@ -29,7 +29,7 @@ import type { FilePayload, Rect, SelectOption, SelectOptionOptions, TimeoutOptio import type * as structs from '../../types/structs'; import type * as api from '../../types/types'; import type { Platform } from '@isomorphic/platform'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; export class ElementHandle extends JSHandle implements api.ElementHandle { private _frame: Frame; diff --git a/packages/playwright-core/src/client/errors.ts b/packages/playwright-core/src/client/errors.ts index ce4869d00d6e5..92169c09d4a36 100644 --- a/packages/playwright-core/src/client/errors.ts +++ b/packages/playwright-core/src/client/errors.ts @@ -17,7 +17,7 @@ import { isError } from '@isomorphic/rtti'; import { parseSerializedValue, serializeValue } from '../protocol/serializers'; -import type { SerializedError } from '@protocol/channels'; +import type { SerializedError } from './channels'; export class PlaywrightError extends Error { log: string[] = []; diff --git a/packages/playwright-core/src/client/fetch.ts b/packages/playwright-core/src/client/fetch.ts index 8d58a81f0fb7f..8f94e622e1853 100644 --- a/packages/playwright-core/src/client/fetch.ts +++ b/packages/playwright-core/src/client/fetch.ts @@ -31,7 +31,7 @@ import type { Serializable } from '../../types/structs'; import type * as api from '../../types/types'; import type { HeadersArray, NameValue } from '@isomorphic/types'; import type { Platform } from '@isomorphic/platform'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; import type * as fs from 'fs'; export type FetchOptions = { diff --git a/packages/playwright-core/src/client/fileChooser.ts b/packages/playwright-core/src/client/fileChooser.ts index 04a08d35a408a..d37e8577e972a 100644 --- a/packages/playwright-core/src/client/fileChooser.ts +++ b/packages/playwright-core/src/client/fileChooser.ts @@ -18,7 +18,7 @@ import type { ElementHandle } from './elementHandle'; import type { Page } from './page'; import type { FilePayload, TimeoutOptions } from './types'; import type * as api from '../../types/types'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; export class FileChooser implements api.FileChooser { private _page: Page; diff --git a/packages/playwright-core/src/client/frame.ts b/packages/playwright-core/src/client/frame.ts index bb28e673771f4..c6b9695ff997d 100644 --- a/packages/playwright-core/src/client/frame.ts +++ b/packages/playwright-core/src/client/frame.ts @@ -38,7 +38,7 @@ import type * as structs from '../../types/structs'; import type * as api from '../../types/types'; import type { ByRoleOptions } from '@isomorphic/locatorUtils'; import type { URLMatch } from '@isomorphic/urlMatch'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; export type WaitForNavigationOptions = { timeout?: number, diff --git a/packages/playwright-core/src/client/input.ts b/packages/playwright-core/src/client/input.ts index d77fc3b54dc03..cb4a551d68645 100644 --- a/packages/playwright-core/src/client/input.ts +++ b/packages/playwright-core/src/client/input.ts @@ -17,7 +17,7 @@ import type { Page } from './page'; import type * as api from '../../types/types'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; export class Keyboard implements api.Keyboard { private _page: Page; diff --git a/packages/playwright-core/src/client/jsHandle.ts b/packages/playwright-core/src/client/jsHandle.ts index 62a54950d5f3b..a6ca8a038f4cf 100644 --- a/packages/playwright-core/src/client/jsHandle.ts +++ b/packages/playwright-core/src/client/jsHandle.ts @@ -20,7 +20,7 @@ import { parseSerializedValue, serializeValue } from '../protocol/serializers'; import type * as structs from '../../types/structs'; import type * as api from '../../types/types'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; export class JSHandle extends ChannelOwner implements api.JSHandle { diff --git a/packages/playwright-core/src/client/jsonPipe.ts b/packages/playwright-core/src/client/jsonPipe.ts index 9e6635638e0a7..9f250329b4a5e 100644 --- a/packages/playwright-core/src/client/jsonPipe.ts +++ b/packages/playwright-core/src/client/jsonPipe.ts @@ -16,7 +16,7 @@ import { ChannelOwner } from './channelOwner'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; export class JsonPipe extends ChannelOwner { static from(jsonPipe: channels.JsonPipeChannel): JsonPipe { diff --git a/packages/playwright-core/src/client/localUtils.ts b/packages/playwright-core/src/client/localUtils.ts index 79a035c0f6b54..5d34adc053941 100644 --- a/packages/playwright-core/src/client/localUtils.ts +++ b/packages/playwright-core/src/client/localUtils.ts @@ -17,7 +17,7 @@ import { ChannelOwner } from './channelOwner'; import type { Size } from './types'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; type DeviceDescriptor = { userAgent: string, diff --git a/packages/playwright-core/src/client/locator.ts b/packages/playwright-core/src/client/locator.ts index fcd2165e7db4a..89c892c540b12 100644 --- a/packages/playwright-core/src/client/locator.ts +++ b/packages/playwright-core/src/client/locator.ts @@ -27,7 +27,7 @@ import type { DropPayload, FilePayload, FrameExpectParams, Rect, SelectOption, S import type * as structs from '../../types/structs'; import type * as api from '../../types/types'; import type { ByRoleOptions } from '@isomorphic/locatorUtils'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; export type LocatorOptions = { diff --git a/packages/playwright-core/src/client/network.ts b/packages/playwright-core/src/client/network.ts index 49ab620c190a7..38b14c38664c1 100644 --- a/packages/playwright-core/src/client/network.ts +++ b/packages/playwright-core/src/client/network.ts @@ -37,7 +37,7 @@ import type { Serializable } from '../../types/structs'; import type * as api from '../../types/types'; import type { HeadersArray } from '@isomorphic/types'; import type { URLMatch } from '@isomorphic/urlMatch'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; import type { Platform, Zone } from '@isomorphic/platform'; export type NetworkCookie = { diff --git a/packages/playwright-core/src/client/page.ts b/packages/playwright-core/src/client/page.ts index b45b623083a7f..3f571d72a83a6 100644 --- a/packages/playwright-core/src/client/page.ts +++ b/packages/playwright-core/src/client/page.ts @@ -55,7 +55,7 @@ import type * as structs from '../../types/structs'; import type * as api from '../../types/types'; import type { ByRoleOptions } from '@isomorphic/locatorUtils'; import type { URLMatch } from '@isomorphic/urlMatch'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; type PDFOptions = Omit & { width?: string | number, diff --git a/packages/playwright-core/src/client/playwright.ts b/packages/playwright-core/src/client/playwright.ts index c5f2074aee984..5e375daa1813e 100644 --- a/packages/playwright-core/src/client/playwright.ts +++ b/packages/playwright-core/src/client/playwright.ts @@ -23,7 +23,7 @@ import { TimeoutError } from './errors'; import { APIRequest } from './fetch'; import { Selectors } from './selectors'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; import type { LaunchOptions } from 'playwright-core'; export class Playwright extends ChannelOwner { diff --git a/packages/playwright-core/src/client/selectors.ts b/packages/playwright-core/src/client/selectors.ts index c287ed989d717..7e5f17f139491 100644 --- a/packages/playwright-core/src/client/selectors.ts +++ b/packages/playwright-core/src/client/selectors.ts @@ -19,7 +19,7 @@ import { setTestIdAttribute } from './locator'; import type { SelectorEngine } from './types'; import type * as api from '../../types/types'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; import type { BrowserContext } from './browserContext'; import type { Platform } from '@isomorphic/platform'; diff --git a/packages/playwright-core/src/client/stream.ts b/packages/playwright-core/src/client/stream.ts index 97c1e4b634351..bbfe8f3045cec 100644 --- a/packages/playwright-core/src/client/stream.ts +++ b/packages/playwright-core/src/client/stream.ts @@ -18,7 +18,7 @@ import { Readable } from 'stream'; import { ChannelOwner } from './channelOwner'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; export class Stream extends ChannelOwner { static from(Stream: channels.StreamChannel): Stream { diff --git a/packages/playwright-core/src/client/tracing.ts b/packages/playwright-core/src/client/tracing.ts index 5d771656b2c27..b4ed8f2a7db8f 100644 --- a/packages/playwright-core/src/client/tracing.ts +++ b/packages/playwright-core/src/client/tracing.ts @@ -21,7 +21,7 @@ import { DisposableStub } from './disposable'; import type { Page } from './page'; import type * as api from '../../types/types'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; export class Tracing extends ChannelOwner implements api.Tracing { private _includeSources = false; diff --git a/packages/playwright-core/src/client/types.ts b/packages/playwright-core/src/client/types.ts index cf7bedd7af974..ee0ae314ce0f2 100644 --- a/packages/playwright-core/src/client/types.ts +++ b/packages/playwright-core/src/client/types.ts @@ -16,7 +16,7 @@ */ import type { Size } from '@isomorphic/types'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; export type { HeadersArray, Point, Quad, Rect, Size } from '@isomorphic/types'; type LoggerSeverity = 'verbose' | 'info' | 'warning' | 'error'; diff --git a/packages/playwright-core/src/client/waiter.ts b/packages/playwright-core/src/client/waiter.ts index e53aeae27d7a5..1ab3bd02945f5 100644 --- a/packages/playwright-core/src/client/waiter.ts +++ b/packages/playwright-core/src/client/waiter.ts @@ -18,7 +18,7 @@ import { rewriteErrorMessage } from '@isomorphic/stackTrace'; import { TimeoutError } from './errors'; import type { ChannelOwner } from './channelOwner'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; import type { EventEmitter } from 'events'; import type { Zone } from '@isomorphic/platform'; diff --git a/packages/playwright-core/src/client/webError.ts b/packages/playwright-core/src/client/webError.ts index 413317633bd9d..2bc5059a22ed1 100644 --- a/packages/playwright-core/src/client/webError.ts +++ b/packages/playwright-core/src/client/webError.ts @@ -16,7 +16,7 @@ import type { Page } from './page'; import type * as api from '../../types/types'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; type WebErrorLocation = channels.BrowserContextPageErrorEvent['location']; diff --git a/packages/playwright-core/src/client/worker.ts b/packages/playwright-core/src/client/worker.ts index 1d11e65b21197..2b5ba55dd26bb 100644 --- a/packages/playwright-core/src/client/worker.ts +++ b/packages/playwright-core/src/client/worker.ts @@ -27,7 +27,7 @@ import type { BrowserContext } from './browserContext'; import type { Page } from './page'; import type * as structs from '../../types/structs'; import type * as api from '../../types/types'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; import type { TimeoutOptions, WaitForEventOptions } from './types'; diff --git a/packages/playwright-core/src/client/writableStream.ts b/packages/playwright-core/src/client/writableStream.ts index 38a2d0214a007..c346ee353c0c6 100644 --- a/packages/playwright-core/src/client/writableStream.ts +++ b/packages/playwright-core/src/client/writableStream.ts @@ -16,7 +16,7 @@ import { ChannelOwner } from './channelOwner'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; import type { Writable } from 'stream'; export class WritableStream extends ChannelOwner { diff --git a/packages/playwright-core/src/protocol/serializers.ts b/packages/playwright-core/src/protocol/serializers.ts index c6d0d926bc59d..ccf795af15987 100644 --- a/packages/playwright-core/src/protocol/serializers.ts +++ b/packages/playwright-core/src/protocol/serializers.ts @@ -14,7 +14,36 @@ * limitations under the License. */ -import type { SerializedValue } from '@protocol/channels'; +export type SerializedValue = { + n?: number, + b?: boolean, + s?: string, + v?: 'null' | 'undefined' | 'NaN' | 'Infinity' | '-Infinity' | '-0', + d?: string, + u?: string, + bi?: string, + ta?: { + b: Buffer, + k: 'i8' | 'ui8' | 'ui8c' | 'i16' | 'ui16' | 'i32' | 'ui32' | 'f32' | 'f64' | 'bi64' | 'bui64', + }, + e?: { + m: string, + n: string, + s: string, + }, + r?: { + p: string, + f: string, + }, + a?: SerializedValue[], + o?: { + k: string, + v: SerializedValue, + }[], + h?: number, + id?: number, + ref?: number, +}; export function parseSerializedValue(value: SerializedValue, handles: any[] | undefined): any { return innerParseSerializedValue(value, handles, new Map(), []); diff --git a/packages/playwright-core/src/server/android/android.ts b/packages/playwright-core/src/server/android/android.ts index 4ddb98ed4a963..1fc6a296bf464 100644 --- a/packages/playwright-core/src/server/android/android.ts +++ b/packages/playwright-core/src/server/android/android.ts @@ -40,7 +40,7 @@ import { registry } from '../registry'; import type { BrowserOptions, BrowserProcess } from '../browser'; import type { BrowserContext } from '../browserContext'; import type * as types from '../types'; -import type * as channels from '@protocol/channels'; +import type * as channels from '../channels'; import type * as stream from 'stream'; const ARTIFACTS_FOLDER = path.join(os.tmpdir(), 'playwright-artifacts-'); diff --git a/packages/playwright-core/src/server/android/backendAdb.ts b/packages/playwright-core/src/server/android/backendAdb.ts index 010dec61c3810..09d4bc0c29295 100644 --- a/packages/playwright-core/src/server/android/backendAdb.ts +++ b/packages/playwright-core/src/server/android/backendAdb.ts @@ -20,7 +20,7 @@ import net from 'net'; import debug from 'debug'; import { assert } from '@isomorphic/assert'; import type { Backend, DeviceBackend, SocketBackend } from './android'; -import type * as channels from '@protocol/channels'; +import type * as channels from '../channels'; export class AdbBackend implements Backend { diff --git a/packages/playwright-core/src/server/artifact.ts b/packages/playwright-core/src/server/artifact.ts index 1a08e7e133737..7e4ee4e59aaf3 100644 --- a/packages/playwright-core/src/server/artifact.ts +++ b/packages/playwright-core/src/server/artifact.ts @@ -21,7 +21,7 @@ import { assert } from '@isomorphic/assert'; import { TargetClosedError } from './errors'; import { SdkObject } from './instrumentation'; -import type { Progress } from '@protocol/progress'; +import type { Progress } from './progress'; type SaveCallback = (localPath: string, error?: Error) => Promise; type CancelCallback = () => Promise; diff --git a/packages/playwright-core/src/server/bidi/bidiBrowser.ts b/packages/playwright-core/src/server/bidi/bidiBrowser.ts index 7e0c9f2863941..236bbec39af9a 100644 --- a/packages/playwright-core/src/server/bidi/bidiBrowser.ts +++ b/packages/playwright-core/src/server/bidi/bidiBrowser.ts @@ -31,7 +31,7 @@ import type { InitScript, Page } from '../page'; import type { ConnectionTransport } from '../transport'; import type * as types from '../types'; import type { BidiSession } from './bidiConnection'; -import type * as channels from '@protocol/channels'; +import type * as channels from '../channels'; export class BidiBrowser extends Browser { diff --git a/packages/playwright-core/src/server/bidi/bidiPage.ts b/packages/playwright-core/src/server/bidi/bidiPage.ts index ac8fd62fcadb5..2380c6da0a156 100644 --- a/packages/playwright-core/src/server/bidi/bidiPage.ts +++ b/packages/playwright-core/src/server/bidi/bidiPage.ts @@ -35,7 +35,7 @@ import type { InitScript, PageDelegate } from '../page'; import type { Progress } from '../progress'; import type * as types from '../types'; import type { BidiSession } from './bidiConnection'; -import type * as channels from '@protocol/channels'; +import type * as channels from '../channels'; const UTILITY_WORLD_NAME = '__playwright_utility_world__'; export const kPlaywrightBindingChannel = 'playwrightChannel'; diff --git a/packages/playwright-core/src/server/bidi/bidiPdf.ts b/packages/playwright-core/src/server/bidi/bidiPdf.ts index bc67b3af82297..7feb148b053f9 100644 --- a/packages/playwright-core/src/server/bidi/bidiPdf.ts +++ b/packages/playwright-core/src/server/bidi/bidiPdf.ts @@ -18,7 +18,7 @@ import { assert } from '@isomorphic/assert'; import type { BidiSession } from './bidiConnection'; -import type * as channels from '@protocol/channels'; +import type * as channels from '../channels'; const PagePaperFormats: { [key: string]: { width: number, height: number }} = { letter: { width: 8.5, height: 11 }, diff --git a/packages/playwright-core/src/server/browser.ts b/packages/playwright-core/src/server/browser.ts index 0f441fdcb1cec..56fff6415a054 100644 --- a/packages/playwright-core/src/server/browser.ts +++ b/packages/playwright-core/src/server/browser.ts @@ -32,7 +32,7 @@ import { TargetClosedError } from './errors'; import type * as types from './types'; import type { ProxySettings } from './types'; import type { RecentLogsCollector } from '@utils/debugLogger'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; import type { ChildProcess } from 'child_process'; import type { Language } from '@isomorphic/locatorGenerators'; import type { Progress } from './progress'; diff --git a/packages/playwright-core/src/server/browserContext.ts b/packages/playwright-core/src/server/browserContext.ts index 788179e985121..2e1ea62038d60 100644 --- a/packages/playwright-core/src/server/browserContext.ts +++ b/packages/playwright-core/src/server/browserContext.ts @@ -44,7 +44,7 @@ import type { Progress } from './progress'; import type { ClientCertificatesProxy } from './socksClientCertificatesInterceptor'; import type { SerializedStorage } from '@injected/storageScript'; import type * as types from './types'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; const BrowserContextEvent = { Console: 'console', diff --git a/packages/playwright-core/src/server/browserType.ts b/packages/playwright-core/src/server/browserType.ts index 3dd0d51969168..70051a4f2b4be 100644 --- a/packages/playwright-core/src/server/browserType.ts +++ b/packages/playwright-core/src/server/browserType.ts @@ -41,7 +41,7 @@ import type { Progress } from './progress'; import type { BrowserName } from './registry'; import type { ConnectionTransport } from './transport'; import type * as types from './types'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; export const kNoXServerRunningError = 'Looks like you launched a headed browser without having a XServer running.\n' + 'Set either \'headless: true\' or use \'xvfb-run \' before running Playwright.\n\n<3 Playwright Team'; diff --git a/packages/playwright-core/src/server/channels.d.ts b/packages/playwright-core/src/server/channels.d.ts new file mode 100644 index 0000000000000..01047a43f6491 --- /dev/null +++ b/packages/playwright-core/src/server/channels.d.ts @@ -0,0 +1,5559 @@ +/** + * Copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// This file is generated by generate_channels.js, do not edit manually. + +import type { Progress } from './progress'; + +export type Binary = Buffer; + +export interface Channel { +} + +// ----------- Initializer Traits ----------- +export type InitializerTraits = + T extends ElementHandleChannel ? ElementHandleInitializer : + T extends AndroidChannel ? AndroidInitializer : + T extends AndroidSocketChannel ? AndroidSocketInitializer : + T extends AndroidDeviceChannel ? AndroidDeviceInitializer : + T extends APIRequestContextChannel ? APIRequestContextInitializer : + T extends ArtifactChannel ? ArtifactInitializer : + T extends StreamChannel ? StreamInitializer : + T extends WritableStreamChannel ? WritableStreamInitializer : + T extends BrowserChannel ? BrowserInitializer : + T extends BrowserContextChannel ? BrowserContextInitializer : + T extends BrowserTypeChannel ? BrowserTypeInitializer : + T extends DisposableChannel ? DisposableInitializer : + T extends ElectronChannel ? ElectronInitializer : + T extends ElectronApplicationChannel ? ElectronApplicationInitializer : + T extends FrameChannel ? FrameInitializer : + T extends JSHandleChannel ? JSHandleInitializer : + T extends LocalUtilsChannel ? LocalUtilsInitializer : + T extends RequestChannel ? RequestInitializer : + T extends RouteChannel ? RouteInitializer : + T extends WebSocketRouteChannel ? WebSocketRouteInitializer : + T extends ResponseChannel ? ResponseInitializer : + T extends WebSocketChannel ? WebSocketInitializer : + T extends PageChannel ? PageInitializer : + T extends RootChannel ? RootInitializer : + T extends PlaywrightChannel ? PlaywrightInitializer : + T extends DebugControllerChannel ? DebugControllerInitializer : + T extends SocksSupportChannel ? SocksSupportInitializer : + T extends JsonPipeChannel ? JsonPipeInitializer : + T extends CDPSessionChannel ? CDPSessionInitializer : + T extends BindingCallChannel ? BindingCallInitializer : + T extends DebuggerChannel ? DebuggerInitializer : + T extends DialogChannel ? DialogInitializer : + T extends TracingChannel ? TracingInitializer : + T extends WorkerChannel ? WorkerInitializer : + object; + +// ----------- Event Traits ----------- +export type EventsTraits = + T extends ElementHandleChannel ? ElementHandleEvents : + T extends AndroidChannel ? AndroidEvents : + T extends AndroidSocketChannel ? AndroidSocketEvents : + T extends AndroidDeviceChannel ? AndroidDeviceEvents : + T extends APIRequestContextChannel ? APIRequestContextEvents : + T extends ArtifactChannel ? ArtifactEvents : + T extends StreamChannel ? StreamEvents : + T extends WritableStreamChannel ? WritableStreamEvents : + T extends BrowserChannel ? BrowserEvents : + T extends BrowserContextChannel ? BrowserContextEvents : + T extends BrowserTypeChannel ? BrowserTypeEvents : + T extends DisposableChannel ? DisposableEvents : + T extends ElectronChannel ? ElectronEvents : + T extends ElectronApplicationChannel ? ElectronApplicationEvents : + T extends FrameChannel ? FrameEvents : + T extends JSHandleChannel ? JSHandleEvents : + T extends LocalUtilsChannel ? LocalUtilsEvents : + T extends RequestChannel ? RequestEvents : + T extends RouteChannel ? RouteEvents : + T extends WebSocketRouteChannel ? WebSocketRouteEvents : + T extends ResponseChannel ? ResponseEvents : + T extends WebSocketChannel ? WebSocketEvents : + T extends PageChannel ? PageEvents : + T extends RootChannel ? RootEvents : + T extends PlaywrightChannel ? PlaywrightEvents : + T extends DebugControllerChannel ? DebugControllerEvents : + T extends SocksSupportChannel ? SocksSupportEvents : + T extends JsonPipeChannel ? JsonPipeEvents : + T extends CDPSessionChannel ? CDPSessionEvents : + T extends BindingCallChannel ? BindingCallEvents : + T extends DebuggerChannel ? DebuggerEvents : + T extends DialogChannel ? DialogEvents : + T extends TracingChannel ? TracingEvents : + T extends WorkerChannel ? WorkerEvents : + undefined; + +// ----------- EventTarget Traits ----------- +export type EventTargetTraits = + T extends ElementHandleChannel ? ElementHandleEventTarget : + T extends AndroidChannel ? AndroidEventTarget : + T extends AndroidSocketChannel ? AndroidSocketEventTarget : + T extends AndroidDeviceChannel ? AndroidDeviceEventTarget : + T extends APIRequestContextChannel ? APIRequestContextEventTarget : + T extends ArtifactChannel ? ArtifactEventTarget : + T extends StreamChannel ? StreamEventTarget : + T extends WritableStreamChannel ? WritableStreamEventTarget : + T extends BrowserChannel ? BrowserEventTarget : + T extends BrowserContextChannel ? BrowserContextEventTarget : + T extends BrowserTypeChannel ? BrowserTypeEventTarget : + T extends DisposableChannel ? DisposableEventTarget : + T extends ElectronChannel ? ElectronEventTarget : + T extends ElectronApplicationChannel ? ElectronApplicationEventTarget : + T extends FrameChannel ? FrameEventTarget : + T extends JSHandleChannel ? JSHandleEventTarget : + T extends LocalUtilsChannel ? LocalUtilsEventTarget : + T extends RequestChannel ? RequestEventTarget : + T extends RouteChannel ? RouteEventTarget : + T extends WebSocketRouteChannel ? WebSocketRouteEventTarget : + T extends ResponseChannel ? ResponseEventTarget : + T extends WebSocketChannel ? WebSocketEventTarget : + T extends PageChannel ? PageEventTarget : + T extends RootChannel ? RootEventTarget : + T extends PlaywrightChannel ? PlaywrightEventTarget : + T extends DebugControllerChannel ? DebugControllerEventTarget : + T extends SocksSupportChannel ? SocksSupportEventTarget : + T extends JsonPipeChannel ? JsonPipeEventTarget : + T extends CDPSessionChannel ? CDPSessionEventTarget : + T extends BindingCallChannel ? BindingCallEventTarget : + T extends DebuggerChannel ? DebuggerEventTarget : + T extends DialogChannel ? DialogEventTarget : + T extends TracingChannel ? TracingEventTarget : + T extends WorkerChannel ? WorkerEventTarget : + undefined; + +// ----------- Android ----------- +export type AndroidInitializer = {}; +export interface AndroidEventTarget { +} +export interface AndroidChannel extends AndroidEventTarget, Channel { + _type_Android: boolean; + devices(params: AndroidDevicesParams, progress: Progress): Promise; +} +export type AndroidDevicesParams = { + host?: string, + port?: number, + omitDriverInstall?: boolean, +}; +export type AndroidDevicesOptions = { + host?: string, + port?: number, + omitDriverInstall?: boolean, +}; +export type AndroidDevicesResult = { + devices: AndroidDeviceChannel[], +}; + +export interface AndroidEvents { +} + +// ----------- AndroidSocket ----------- +export type AndroidSocketInitializer = {}; +export interface AndroidSocketEventTarget { + _dispatchEvent(event: 'data', params?: AndroidSocketDataEvent): void; + _dispatchEvent(event: 'close', params?: AndroidSocketCloseEvent): void; +} +export interface AndroidSocketChannel extends AndroidSocketEventTarget, Channel { + _type_AndroidSocket: boolean; + write(params: AndroidSocketWriteParams, progress: Progress): Promise; + close(params: AndroidSocketCloseParams, progress: Progress): Promise; +} +export type AndroidSocketDataEvent = { + data: Binary, +}; +export type AndroidSocketCloseEvent = {}; +export type AndroidSocketWriteParams = { + data: Binary, +}; +export type AndroidSocketWriteOptions = { + +}; +export type AndroidSocketWriteResult = void; +export type AndroidSocketCloseParams = {}; +export type AndroidSocketCloseOptions = {}; +export type AndroidSocketCloseResult = void; + +export interface AndroidSocketEvents { + 'data': AndroidSocketDataEvent; + 'close': AndroidSocketCloseEvent; +} + +// ----------- AndroidDevice ----------- +export type AndroidDeviceInitializer = { + model: string, + serial: string, +}; +export interface AndroidDeviceEventTarget { + _dispatchEvent(event: 'close', params?: AndroidDeviceCloseEvent): void; + _dispatchEvent(event: 'webViewAdded', params?: AndroidDeviceWebViewAddedEvent): void; + _dispatchEvent(event: 'webViewRemoved', params?: AndroidDeviceWebViewRemovedEvent): void; +} +export interface AndroidDeviceChannel extends AndroidDeviceEventTarget, Channel { + _type_AndroidDevice: boolean; + wait(params: AndroidDeviceWaitParams, progress: Progress): Promise; + fill(params: AndroidDeviceFillParams, progress: Progress): Promise; + tap(params: AndroidDeviceTapParams, progress: Progress): Promise; + drag(params: AndroidDeviceDragParams, progress: Progress): Promise; + fling(params: AndroidDeviceFlingParams, progress: Progress): Promise; + longTap(params: AndroidDeviceLongTapParams, progress: Progress): Promise; + pinchClose(params: AndroidDevicePinchCloseParams, progress: Progress): Promise; + pinchOpen(params: AndroidDevicePinchOpenParams, progress: Progress): Promise; + scroll(params: AndroidDeviceScrollParams, progress: Progress): Promise; + swipe(params: AndroidDeviceSwipeParams, progress: Progress): Promise; + info(params: AndroidDeviceInfoParams, progress: Progress): Promise; + screenshot(params: AndroidDeviceScreenshotParams, progress: Progress): Promise; + inputType(params: AndroidDeviceInputTypeParams, progress: Progress): Promise; + inputPress(params: AndroidDeviceInputPressParams, progress: Progress): Promise; + inputTap(params: AndroidDeviceInputTapParams, progress: Progress): Promise; + inputSwipe(params: AndroidDeviceInputSwipeParams, progress: Progress): Promise; + inputDrag(params: AndroidDeviceInputDragParams, progress: Progress): Promise; + launchBrowser(params: AndroidDeviceLaunchBrowserParams, progress: Progress): Promise; + open(params: AndroidDeviceOpenParams, progress: Progress): Promise; + shell(params: AndroidDeviceShellParams, progress: Progress): Promise; + installApk(params: AndroidDeviceInstallApkParams, progress: Progress): Promise; + push(params: AndroidDevicePushParams, progress: Progress): Promise; + connectToWebView(params: AndroidDeviceConnectToWebViewParams, progress: Progress): Promise; + close(params: AndroidDeviceCloseParams, progress: Progress): Promise; +} +export type AndroidDeviceCloseEvent = {}; +export type AndroidDeviceWebViewAddedEvent = { + webView: AndroidWebView, +}; +export type AndroidDeviceWebViewRemovedEvent = { + socketName: string, +}; +export type AndroidDeviceWaitParams = { + androidSelector: AndroidSelector, + state?: 'gone', + timeout: number, +}; +export type AndroidDeviceWaitOptions = { + state?: 'gone', +}; +export type AndroidDeviceWaitResult = void; +export type AndroidDeviceFillParams = { + androidSelector: AndroidSelector, + text: string, + timeout: number, +}; +export type AndroidDeviceFillOptions = { + +}; +export type AndroidDeviceFillResult = void; +export type AndroidDeviceTapParams = { + androidSelector: AndroidSelector, + duration?: number, + timeout: number, +}; +export type AndroidDeviceTapOptions = { + duration?: number, +}; +export type AndroidDeviceTapResult = void; +export type AndroidDeviceDragParams = { + androidSelector: AndroidSelector, + dest: Point, + speed?: number, + timeout: number, +}; +export type AndroidDeviceDragOptions = { + speed?: number, +}; +export type AndroidDeviceDragResult = void; +export type AndroidDeviceFlingParams = { + androidSelector: AndroidSelector, + direction: 'up' | 'down' | 'left' | 'right', + speed?: number, + timeout: number, +}; +export type AndroidDeviceFlingOptions = { + speed?: number, +}; +export type AndroidDeviceFlingResult = void; +export type AndroidDeviceLongTapParams = { + androidSelector: AndroidSelector, + timeout: number, +}; +export type AndroidDeviceLongTapOptions = { + +}; +export type AndroidDeviceLongTapResult = void; +export type AndroidDevicePinchCloseParams = { + androidSelector: AndroidSelector, + percent: number, + speed?: number, + timeout: number, +}; +export type AndroidDevicePinchCloseOptions = { + speed?: number, +}; +export type AndroidDevicePinchCloseResult = void; +export type AndroidDevicePinchOpenParams = { + androidSelector: AndroidSelector, + percent: number, + speed?: number, + timeout: number, +}; +export type AndroidDevicePinchOpenOptions = { + speed?: number, +}; +export type AndroidDevicePinchOpenResult = void; +export type AndroidDeviceScrollParams = { + androidSelector: AndroidSelector, + direction: 'up' | 'down' | 'left' | 'right', + percent: number, + speed?: number, + timeout: number, +}; +export type AndroidDeviceScrollOptions = { + speed?: number, +}; +export type AndroidDeviceScrollResult = void; +export type AndroidDeviceSwipeParams = { + androidSelector: AndroidSelector, + direction: 'up' | 'down' | 'left' | 'right', + percent: number, + speed?: number, + timeout: number, +}; +export type AndroidDeviceSwipeOptions = { + speed?: number, +}; +export type AndroidDeviceSwipeResult = void; +export type AndroidDeviceInfoParams = { + androidSelector: AndroidSelector, +}; +export type AndroidDeviceInfoOptions = { + +}; +export type AndroidDeviceInfoResult = { + info: AndroidElementInfo, +}; +export type AndroidDeviceScreenshotParams = {}; +export type AndroidDeviceScreenshotOptions = {}; +export type AndroidDeviceScreenshotResult = { + binary: Binary, +}; +export type AndroidDeviceInputTypeParams = { + text: string, +}; +export type AndroidDeviceInputTypeOptions = { + +}; +export type AndroidDeviceInputTypeResult = void; +export type AndroidDeviceInputPressParams = { + key: string, +}; +export type AndroidDeviceInputPressOptions = { + +}; +export type AndroidDeviceInputPressResult = void; +export type AndroidDeviceInputTapParams = { + point: Point, +}; +export type AndroidDeviceInputTapOptions = { + +}; +export type AndroidDeviceInputTapResult = void; +export type AndroidDeviceInputSwipeParams = { + segments: Point[], + steps: number, +}; +export type AndroidDeviceInputSwipeOptions = { + +}; +export type AndroidDeviceInputSwipeResult = void; +export type AndroidDeviceInputDragParams = { + from: Point, + to: Point, + steps: number, +}; +export type AndroidDeviceInputDragOptions = { + +}; +export type AndroidDeviceInputDragResult = void; +export type AndroidDeviceLaunchBrowserParams = { + noDefaultViewport?: boolean, + viewport?: { + width: number, + height: number, + }, + screen?: { + width: number, + height: number, + }, + ignoreHTTPSErrors?: boolean, + clientCertificates?: { + origin: string, + cert?: Binary, + key?: Binary, + passphrase?: string, + pfx?: Binary, + }[], + javaScriptEnabled?: boolean, + bypassCSP?: boolean, + userAgent?: string, + locale?: string, + timezoneId?: string, + geolocation?: { + longitude: number, + latitude: number, + accuracy?: number, + }, + permissions?: string[], + extraHTTPHeaders?: NameValue[], + offline?: boolean, + httpCredentials?: { + username: string, + password: string, + origin?: string, + send?: 'always' | 'unauthorized', + }, + deviceScaleFactor?: number, + isMobile?: boolean, + hasTouch?: boolean, + colorScheme?: 'dark' | 'light' | 'no-preference' | 'no-override', + reducedMotion?: 'reduce' | 'no-preference' | 'no-override', + forcedColors?: 'active' | 'none' | 'no-override', + acceptDownloads?: 'accept' | 'deny' | 'internal-browser-default', + contrast?: 'no-preference' | 'more' | 'no-override', + baseURL?: string, + recordVideo?: { + dir?: string, + size?: { + width: number, + height: number, + }, + showActions?: { + duration?: number, + position?: 'top-left' | 'top' | 'top-right' | 'bottom-left' | 'bottom' | 'bottom-right', + fontSize?: number, + cursor?: 'none' | 'pointer', + }, + }, + strictSelectors?: boolean, + serviceWorkers?: 'allow' | 'block', + selectorEngines?: SelectorEngine[], + testIdAttributeName?: string, + pkg?: string, + args?: string[], + proxy?: { + server: string, + bypass?: string, + username?: string, + password?: string, + }, +}; +export type AndroidDeviceLaunchBrowserOptions = { + noDefaultViewport?: boolean, + viewport?: { + width: number, + height: number, + }, + screen?: { + width: number, + height: number, + }, + ignoreHTTPSErrors?: boolean, + clientCertificates?: { + origin: string, + cert?: Binary, + key?: Binary, + passphrase?: string, + pfx?: Binary, + }[], + javaScriptEnabled?: boolean, + bypassCSP?: boolean, + userAgent?: string, + locale?: string, + timezoneId?: string, + geolocation?: { + longitude: number, + latitude: number, + accuracy?: number, + }, + permissions?: string[], + extraHTTPHeaders?: NameValue[], + offline?: boolean, + httpCredentials?: { + username: string, + password: string, + origin?: string, + send?: 'always' | 'unauthorized', + }, + deviceScaleFactor?: number, + isMobile?: boolean, + hasTouch?: boolean, + colorScheme?: 'dark' | 'light' | 'no-preference' | 'no-override', + reducedMotion?: 'reduce' | 'no-preference' | 'no-override', + forcedColors?: 'active' | 'none' | 'no-override', + acceptDownloads?: 'accept' | 'deny' | 'internal-browser-default', + contrast?: 'no-preference' | 'more' | 'no-override', + baseURL?: string, + recordVideo?: { + dir?: string, + size?: { + width: number, + height: number, + }, + showActions?: { + duration?: number, + position?: 'top-left' | 'top' | 'top-right' | 'bottom-left' | 'bottom' | 'bottom-right', + fontSize?: number, + cursor?: 'none' | 'pointer', + }, + }, + strictSelectors?: boolean, + serviceWorkers?: 'allow' | 'block', + selectorEngines?: SelectorEngine[], + testIdAttributeName?: string, + pkg?: string, + args?: string[], + proxy?: { + server: string, + bypass?: string, + username?: string, + password?: string, + }, +}; +export type AndroidDeviceLaunchBrowserResult = { + context: BrowserContextChannel, +}; +export type AndroidDeviceOpenParams = { + command: string, +}; +export type AndroidDeviceOpenOptions = { + +}; +export type AndroidDeviceOpenResult = { + socket: AndroidSocketChannel, +}; +export type AndroidDeviceShellParams = { + command: string, +}; +export type AndroidDeviceShellOptions = { + +}; +export type AndroidDeviceShellResult = { + result: Binary, +}; +export type AndroidDeviceInstallApkParams = { + file: Binary, + args?: string[], +}; +export type AndroidDeviceInstallApkOptions = { + args?: string[], +}; +export type AndroidDeviceInstallApkResult = void; +export type AndroidDevicePushParams = { + file: Binary, + path: string, + mode?: number, +}; +export type AndroidDevicePushOptions = { + mode?: number, +}; +export type AndroidDevicePushResult = void; +export type AndroidDeviceConnectToWebViewParams = { + socketName: string, +}; +export type AndroidDeviceConnectToWebViewOptions = { + +}; +export type AndroidDeviceConnectToWebViewResult = { + context: BrowserContextChannel, +}; +export type AndroidDeviceCloseParams = {}; +export type AndroidDeviceCloseOptions = {}; +export type AndroidDeviceCloseResult = void; + +export interface AndroidDeviceEvents { + 'close': AndroidDeviceCloseEvent; + 'webViewAdded': AndroidDeviceWebViewAddedEvent; + 'webViewRemoved': AndroidDeviceWebViewRemovedEvent; +} + +export type AndroidWebView = { + pid: number, + pkg: string, + socketName: string, +}; + +export type AndroidSelector = { + checkable?: boolean, + checked?: boolean, + clazz?: string, + clickable?: boolean, + depth?: number, + desc?: string, + enabled?: boolean, + focusable?: boolean, + focused?: boolean, + hasChild?: { + androidSelector: AndroidSelector, + }, + hasDescendant?: { + androidSelector: AndroidSelector, + maxDepth?: number, + }, + longClickable?: boolean, + pkg?: string, + res?: string, + scrollable?: boolean, + selected?: boolean, + text?: string, +}; + +export type AndroidElementInfo = { + children?: AndroidElementInfo[], + clazz: string, + desc: string, + res: string, + pkg: string, + text: string, + bounds: Rect, + checkable: boolean, + checked: boolean, + clickable: boolean, + enabled: boolean, + focusable: boolean, + focused: boolean, + longClickable: boolean, + scrollable: boolean, + selected: boolean, +}; + +// ----------- APIRequestContext ----------- +export type APIRequestContextInitializer = { + tracing: TracingChannel, +}; +export interface APIRequestContextEventTarget { +} +export interface APIRequestContextChannel extends APIRequestContextEventTarget, Channel { + _type_APIRequestContext: boolean; + fetch(params: APIRequestContextFetchParams, progress: Progress): Promise; + fetchResponseBody(params: APIRequestContextFetchResponseBodyParams, progress: Progress): Promise; + fetchLog(params: APIRequestContextFetchLogParams, progress: Progress): Promise; + storageState(params: APIRequestContextStorageStateParams, progress: Progress): Promise; + disposeAPIResponse(params: APIRequestContextDisposeAPIResponseParams, progress: Progress): Promise; + dispose(params: APIRequestContextDisposeParams, progress: Progress): Promise; +} +export type APIRequestContextFetchParams = { + url: string, + encodedParams?: string, + params?: NameValue[], + method?: string, + headers?: NameValue[], + postData?: Binary, + jsonData?: string, + formData?: NameValue[], + multipartData?: FormField[], + timeout: number, + failOnStatusCode?: boolean, + ignoreHTTPSErrors?: boolean, + maxRedirects?: number, + maxRetries?: number, +}; +export type APIRequestContextFetchOptions = { + encodedParams?: string, + params?: NameValue[], + method?: string, + headers?: NameValue[], + postData?: Binary, + jsonData?: string, + formData?: NameValue[], + multipartData?: FormField[], + failOnStatusCode?: boolean, + ignoreHTTPSErrors?: boolean, + maxRedirects?: number, + maxRetries?: number, +}; +export type APIRequestContextFetchResult = { + response: APIResponse, +}; +export type APIRequestContextFetchResponseBodyParams = { + fetchUid: string, +}; +export type APIRequestContextFetchResponseBodyOptions = { + +}; +export type APIRequestContextFetchResponseBodyResult = { + binary?: Binary, +}; +export type APIRequestContextFetchLogParams = { + fetchUid: string, +}; +export type APIRequestContextFetchLogOptions = { + +}; +export type APIRequestContextFetchLogResult = { + log: string[], +}; +export type APIRequestContextStorageStateParams = { + indexedDB?: boolean, +}; +export type APIRequestContextStorageStateOptions = { + indexedDB?: boolean, +}; +export type APIRequestContextStorageStateResult = { + cookies: NetworkCookie[], + origins: OriginStorage[], +}; +export type APIRequestContextDisposeAPIResponseParams = { + fetchUid: string, +}; +export type APIRequestContextDisposeAPIResponseOptions = { + +}; +export type APIRequestContextDisposeAPIResponseResult = void; +export type APIRequestContextDisposeParams = { + reason?: string, +}; +export type APIRequestContextDisposeOptions = { + reason?: string, +}; +export type APIRequestContextDisposeResult = void; + +export interface APIRequestContextEvents { +} + +export type APIResponse = { + fetchUid: string, + url: string, + status: number, + statusText: string, + headers: NameValue[], + securityDetails?: SecurityDetails, + serverAddr?: RemoteAddr, +}; + +// ----------- Artifact ----------- +export type ArtifactInitializer = { + absolutePath: string, +}; +export interface ArtifactEventTarget { +} +export interface ArtifactChannel extends ArtifactEventTarget, Channel { + _type_Artifact: boolean; + pathAfterFinished(params: ArtifactPathAfterFinishedParams, progress: Progress): Promise; + saveAs(params: ArtifactSaveAsParams, progress: Progress): Promise; + saveAsStream(params: ArtifactSaveAsStreamParams, progress: Progress): Promise; + failure(params: ArtifactFailureParams, progress: Progress): Promise; + stream(params: ArtifactStreamParams, progress: Progress): Promise; + cancel(params: ArtifactCancelParams, progress: Progress): Promise; + delete(params: ArtifactDeleteParams, progress: Progress): Promise; +} +export type ArtifactPathAfterFinishedParams = {}; +export type ArtifactPathAfterFinishedOptions = {}; +export type ArtifactPathAfterFinishedResult = { + value: string, +}; +export type ArtifactSaveAsParams = { + path: string, +}; +export type ArtifactSaveAsOptions = { + +}; +export type ArtifactSaveAsResult = void; +export type ArtifactSaveAsStreamParams = {}; +export type ArtifactSaveAsStreamOptions = {}; +export type ArtifactSaveAsStreamResult = { + stream: StreamChannel, +}; +export type ArtifactFailureParams = {}; +export type ArtifactFailureOptions = {}; +export type ArtifactFailureResult = { + error?: string, +}; +export type ArtifactStreamParams = {}; +export type ArtifactStreamOptions = {}; +export type ArtifactStreamResult = { + stream: StreamChannel, +}; +export type ArtifactCancelParams = {}; +export type ArtifactCancelOptions = {}; +export type ArtifactCancelResult = void; +export type ArtifactDeleteParams = {}; +export type ArtifactDeleteOptions = {}; +export type ArtifactDeleteResult = void; + +export interface ArtifactEvents { +} + +// ----------- Stream ----------- +export type StreamInitializer = {}; +export interface StreamEventTarget { +} +export interface StreamChannel extends StreamEventTarget, Channel { + _type_Stream: boolean; + read(params: StreamReadParams, progress: Progress): Promise; + close(params: StreamCloseParams, progress: Progress): Promise; +} +export type StreamReadParams = { + size?: number, +}; +export type StreamReadOptions = { + size?: number, +}; +export type StreamReadResult = { + binary: Binary, +}; +export type StreamCloseParams = {}; +export type StreamCloseOptions = {}; +export type StreamCloseResult = void; + +export interface StreamEvents { +} + +// ----------- WritableStream ----------- +export type WritableStreamInitializer = {}; +export interface WritableStreamEventTarget { +} +export interface WritableStreamChannel extends WritableStreamEventTarget, Channel { + _type_WritableStream: boolean; + write(params: WritableStreamWriteParams, progress: Progress): Promise; + close(params: WritableStreamCloseParams, progress: Progress): Promise; +} +export type WritableStreamWriteParams = { + binary: Binary, +}; +export type WritableStreamWriteOptions = { + +}; +export type WritableStreamWriteResult = void; +export type WritableStreamCloseParams = {}; +export type WritableStreamCloseOptions = {}; +export type WritableStreamCloseResult = void; + +export interface WritableStreamEvents { +} + +// ----------- Browser ----------- +export type BrowserInitializer = { + version: string, + name: string, + browserName: 'chromium' | 'firefox' | 'webkit', +}; +export interface BrowserEventTarget { + _dispatchEvent(event: 'context', params?: BrowserContextEvent): void; + _dispatchEvent(event: 'close', params?: BrowserCloseEvent): void; +} +export interface BrowserChannel extends BrowserEventTarget, Channel { + _type_Browser: boolean; + startServer(params: BrowserStartServerParams, progress: Progress): Promise; + stopServer(params: BrowserStopServerParams, progress: Progress): Promise; + close(params: BrowserCloseParams, progress: Progress): Promise; + killForTests(params: BrowserKillForTestsParams, progress: Progress): Promise; + defaultUserAgentForTest(params: BrowserDefaultUserAgentForTestParams, progress: Progress): Promise; + newContext(params: BrowserNewContextParams, progress: Progress): Promise; + newContextForReuse(params: BrowserNewContextForReuseParams, progress: Progress): Promise; + disconnectFromReusedContext(params: BrowserDisconnectFromReusedContextParams, progress: Progress): Promise; + newBrowserCDPSession(params: BrowserNewBrowserCDPSessionParams, progress: Progress): Promise; + startTracing(params: BrowserStartTracingParams, progress: Progress): Promise; + stopTracing(params: BrowserStopTracingParams, progress: Progress): Promise; +} +export type BrowserContextEvent = { + context: BrowserContextChannel, +}; +export type BrowserCloseEvent = {}; +export type BrowserStartServerParams = { + title: string, + workspaceDir?: string, + metadata?: any, + host?: string, + port?: number, +}; +export type BrowserStartServerOptions = { + workspaceDir?: string, + metadata?: any, + host?: string, + port?: number, +}; +export type BrowserStartServerResult = { + endpoint: string, +}; +export type BrowserStopServerParams = {}; +export type BrowserStopServerOptions = {}; +export type BrowserStopServerResult = void; +export type BrowserCloseParams = { + reason?: string, +}; +export type BrowserCloseOptions = { + reason?: string, +}; +export type BrowserCloseResult = void; +export type BrowserKillForTestsParams = {}; +export type BrowserKillForTestsOptions = {}; +export type BrowserKillForTestsResult = void; +export type BrowserDefaultUserAgentForTestParams = {}; +export type BrowserDefaultUserAgentForTestOptions = {}; +export type BrowserDefaultUserAgentForTestResult = { + userAgent: string, +}; +export type BrowserNewContextParams = { + noDefaultViewport?: boolean, + viewport?: { + width: number, + height: number, + }, + screen?: { + width: number, + height: number, + }, + ignoreHTTPSErrors?: boolean, + clientCertificates?: { + origin: string, + cert?: Binary, + key?: Binary, + passphrase?: string, + pfx?: Binary, + }[], + javaScriptEnabled?: boolean, + bypassCSP?: boolean, + userAgent?: string, + locale?: string, + timezoneId?: string, + geolocation?: { + longitude: number, + latitude: number, + accuracy?: number, + }, + permissions?: string[], + extraHTTPHeaders?: NameValue[], + offline?: boolean, + httpCredentials?: { + username: string, + password: string, + origin?: string, + send?: 'always' | 'unauthorized', + }, + deviceScaleFactor?: number, + isMobile?: boolean, + hasTouch?: boolean, + colorScheme?: 'dark' | 'light' | 'no-preference' | 'no-override', + reducedMotion?: 'reduce' | 'no-preference' | 'no-override', + forcedColors?: 'active' | 'none' | 'no-override', + acceptDownloads?: 'accept' | 'deny' | 'internal-browser-default', + contrast?: 'no-preference' | 'more' | 'no-override', + baseURL?: string, + recordVideo?: { + dir?: string, + size?: { + width: number, + height: number, + }, + showActions?: { + duration?: number, + position?: 'top-left' | 'top' | 'top-right' | 'bottom-left' | 'bottom' | 'bottom-right', + fontSize?: number, + cursor?: 'none' | 'pointer', + }, + }, + strictSelectors?: boolean, + serviceWorkers?: 'allow' | 'block', + selectorEngines?: SelectorEngine[], + testIdAttributeName?: string, + proxy?: { + server: string, + bypass?: string, + username?: string, + password?: string, + }, + storageState?: { + cookies?: SetNetworkCookie[], + origins?: SetOriginStorage[], + }, +}; +export type BrowserNewContextOptions = { + noDefaultViewport?: boolean, + viewport?: { + width: number, + height: number, + }, + screen?: { + width: number, + height: number, + }, + ignoreHTTPSErrors?: boolean, + clientCertificates?: { + origin: string, + cert?: Binary, + key?: Binary, + passphrase?: string, + pfx?: Binary, + }[], + javaScriptEnabled?: boolean, + bypassCSP?: boolean, + userAgent?: string, + locale?: string, + timezoneId?: string, + geolocation?: { + longitude: number, + latitude: number, + accuracy?: number, + }, + permissions?: string[], + extraHTTPHeaders?: NameValue[], + offline?: boolean, + httpCredentials?: { + username: string, + password: string, + origin?: string, + send?: 'always' | 'unauthorized', + }, + deviceScaleFactor?: number, + isMobile?: boolean, + hasTouch?: boolean, + colorScheme?: 'dark' | 'light' | 'no-preference' | 'no-override', + reducedMotion?: 'reduce' | 'no-preference' | 'no-override', + forcedColors?: 'active' | 'none' | 'no-override', + acceptDownloads?: 'accept' | 'deny' | 'internal-browser-default', + contrast?: 'no-preference' | 'more' | 'no-override', + baseURL?: string, + recordVideo?: { + dir?: string, + size?: { + width: number, + height: number, + }, + showActions?: { + duration?: number, + position?: 'top-left' | 'top' | 'top-right' | 'bottom-left' | 'bottom' | 'bottom-right', + fontSize?: number, + cursor?: 'none' | 'pointer', + }, + }, + strictSelectors?: boolean, + serviceWorkers?: 'allow' | 'block', + selectorEngines?: SelectorEngine[], + testIdAttributeName?: string, + proxy?: { + server: string, + bypass?: string, + username?: string, + password?: string, + }, + storageState?: { + cookies?: SetNetworkCookie[], + origins?: SetOriginStorage[], + }, +}; +export type BrowserNewContextResult = { + context: BrowserContextChannel, +}; +export type BrowserNewContextForReuseParams = { + noDefaultViewport?: boolean, + viewport?: { + width: number, + height: number, + }, + screen?: { + width: number, + height: number, + }, + ignoreHTTPSErrors?: boolean, + clientCertificates?: { + origin: string, + cert?: Binary, + key?: Binary, + passphrase?: string, + pfx?: Binary, + }[], + javaScriptEnabled?: boolean, + bypassCSP?: boolean, + userAgent?: string, + locale?: string, + timezoneId?: string, + geolocation?: { + longitude: number, + latitude: number, + accuracy?: number, + }, + permissions?: string[], + extraHTTPHeaders?: NameValue[], + offline?: boolean, + httpCredentials?: { + username: string, + password: string, + origin?: string, + send?: 'always' | 'unauthorized', + }, + deviceScaleFactor?: number, + isMobile?: boolean, + hasTouch?: boolean, + colorScheme?: 'dark' | 'light' | 'no-preference' | 'no-override', + reducedMotion?: 'reduce' | 'no-preference' | 'no-override', + forcedColors?: 'active' | 'none' | 'no-override', + acceptDownloads?: 'accept' | 'deny' | 'internal-browser-default', + contrast?: 'no-preference' | 'more' | 'no-override', + baseURL?: string, + recordVideo?: { + dir?: string, + size?: { + width: number, + height: number, + }, + showActions?: { + duration?: number, + position?: 'top-left' | 'top' | 'top-right' | 'bottom-left' | 'bottom' | 'bottom-right', + fontSize?: number, + cursor?: 'none' | 'pointer', + }, + }, + strictSelectors?: boolean, + serviceWorkers?: 'allow' | 'block', + selectorEngines?: SelectorEngine[], + testIdAttributeName?: string, + proxy?: { + server: string, + bypass?: string, + username?: string, + password?: string, + }, + storageState?: { + cookies?: SetNetworkCookie[], + origins?: SetOriginStorage[], + }, +}; +export type BrowserNewContextForReuseOptions = { + noDefaultViewport?: boolean, + viewport?: { + width: number, + height: number, + }, + screen?: { + width: number, + height: number, + }, + ignoreHTTPSErrors?: boolean, + clientCertificates?: { + origin: string, + cert?: Binary, + key?: Binary, + passphrase?: string, + pfx?: Binary, + }[], + javaScriptEnabled?: boolean, + bypassCSP?: boolean, + userAgent?: string, + locale?: string, + timezoneId?: string, + geolocation?: { + longitude: number, + latitude: number, + accuracy?: number, + }, + permissions?: string[], + extraHTTPHeaders?: NameValue[], + offline?: boolean, + httpCredentials?: { + username: string, + password: string, + origin?: string, + send?: 'always' | 'unauthorized', + }, + deviceScaleFactor?: number, + isMobile?: boolean, + hasTouch?: boolean, + colorScheme?: 'dark' | 'light' | 'no-preference' | 'no-override', + reducedMotion?: 'reduce' | 'no-preference' | 'no-override', + forcedColors?: 'active' | 'none' | 'no-override', + acceptDownloads?: 'accept' | 'deny' | 'internal-browser-default', + contrast?: 'no-preference' | 'more' | 'no-override', + baseURL?: string, + recordVideo?: { + dir?: string, + size?: { + width: number, + height: number, + }, + showActions?: { + duration?: number, + position?: 'top-left' | 'top' | 'top-right' | 'bottom-left' | 'bottom' | 'bottom-right', + fontSize?: number, + cursor?: 'none' | 'pointer', + }, + }, + strictSelectors?: boolean, + serviceWorkers?: 'allow' | 'block', + selectorEngines?: SelectorEngine[], + testIdAttributeName?: string, + proxy?: { + server: string, + bypass?: string, + username?: string, + password?: string, + }, + storageState?: { + cookies?: SetNetworkCookie[], + origins?: SetOriginStorage[], + }, +}; +export type BrowserNewContextForReuseResult = { + context: BrowserContextChannel, +}; +export type BrowserDisconnectFromReusedContextParams = { + reason: string, +}; +export type BrowserDisconnectFromReusedContextOptions = { + +}; +export type BrowserDisconnectFromReusedContextResult = void; +export type BrowserNewBrowserCDPSessionParams = {}; +export type BrowserNewBrowserCDPSessionOptions = {}; +export type BrowserNewBrowserCDPSessionResult = { + session: CDPSessionChannel, +}; +export type BrowserStartTracingParams = { + page?: PageChannel, + screenshots?: boolean, + categories?: string[], +}; +export type BrowserStartTracingOptions = { + page?: PageChannel, + screenshots?: boolean, + categories?: string[], +}; +export type BrowserStartTracingResult = void; +export type BrowserStopTracingParams = {}; +export type BrowserStopTracingOptions = {}; +export type BrowserStopTracingResult = { + artifact: ArtifactChannel, +}; + +export interface BrowserEvents { + 'context': BrowserContextEvent; + 'close': BrowserCloseEvent; +} + +// ----------- BrowserContext ----------- +export type BrowserContextInitializer = { + debugger: DebuggerChannel, + requestContext: APIRequestContextChannel, + tracing: TracingChannel, + options: { + noDefaultViewport?: boolean, + viewport?: { + width: number, + height: number, + }, + screen?: { + width: number, + height: number, + }, + ignoreHTTPSErrors?: boolean, + clientCertificates?: { + origin: string, + cert?: Binary, + key?: Binary, + passphrase?: string, + pfx?: Binary, + }[], + javaScriptEnabled?: boolean, + bypassCSP?: boolean, + userAgent?: string, + locale?: string, + timezoneId?: string, + geolocation?: { + longitude: number, + latitude: number, + accuracy?: number, + }, + permissions?: string[], + extraHTTPHeaders?: NameValue[], + offline?: boolean, + httpCredentials?: { + username: string, + password: string, + origin?: string, + send?: 'always' | 'unauthorized', + }, + deviceScaleFactor?: number, + isMobile?: boolean, + hasTouch?: boolean, + colorScheme?: 'dark' | 'light' | 'no-preference' | 'no-override', + reducedMotion?: 'reduce' | 'no-preference' | 'no-override', + forcedColors?: 'active' | 'none' | 'no-override', + acceptDownloads?: 'accept' | 'deny' | 'internal-browser-default', + contrast?: 'no-preference' | 'more' | 'no-override', + baseURL?: string, + recordVideo?: { + dir?: string, + size?: { + width: number, + height: number, + }, + showActions?: { + duration?: number, + position?: 'top-left' | 'top' | 'top-right' | 'bottom-left' | 'bottom' | 'bottom-right', + fontSize?: number, + cursor?: 'none' | 'pointer', + }, + }, + strictSelectors?: boolean, + serviceWorkers?: 'allow' | 'block', + selectorEngines?: SelectorEngine[], + testIdAttributeName?: string, + }, +}; +export interface BrowserContextEventTarget { + _dispatchEvent(event: 'bindingCall', params?: BrowserContextBindingCallEvent): void; + _dispatchEvent(event: 'console', params?: BrowserContextConsoleEvent): void; + _dispatchEvent(event: 'close', params?: BrowserContextCloseEvent): void; + _dispatchEvent(event: 'dialog', params?: BrowserContextDialogEvent): void; + _dispatchEvent(event: 'page', params?: BrowserContextPageEvent): void; + _dispatchEvent(event: 'pageError', params?: BrowserContextPageErrorEvent): void; + _dispatchEvent(event: 'route', params?: BrowserContextRouteEvent): void; + _dispatchEvent(event: 'webSocketRoute', params?: BrowserContextWebSocketRouteEvent): void; + _dispatchEvent(event: 'serviceWorker', params?: BrowserContextServiceWorkerEvent): void; + _dispatchEvent(event: 'request', params?: BrowserContextRequestEvent): void; + _dispatchEvent(event: 'requestFailed', params?: BrowserContextRequestFailedEvent): void; + _dispatchEvent(event: 'requestFinished', params?: BrowserContextRequestFinishedEvent): void; + _dispatchEvent(event: 'response', params?: BrowserContextResponseEvent): void; + _dispatchEvent(event: 'recorderEvent', params?: BrowserContextRecorderEventEvent): void; +} +export interface BrowserContextChannel extends BrowserContextEventTarget, Channel { + _type_BrowserContext: boolean; + addCookies(params: BrowserContextAddCookiesParams, progress: Progress): Promise; + addInitScript(params: BrowserContextAddInitScriptParams, progress: Progress): Promise; + clearCookies(params: BrowserContextClearCookiesParams, progress: Progress): Promise; + clearPermissions(params: BrowserContextClearPermissionsParams, progress: Progress): Promise; + close(params: BrowserContextCloseParams, progress: Progress): Promise; + cookies(params: BrowserContextCookiesParams, progress: Progress): Promise; + exposeBinding(params: BrowserContextExposeBindingParams, progress: Progress): Promise; + grantPermissions(params: BrowserContextGrantPermissionsParams, progress: Progress): Promise; + newPage(params: BrowserContextNewPageParams, progress: Progress): Promise; + registerSelectorEngine(params: BrowserContextRegisterSelectorEngineParams, progress: Progress): Promise; + setTestIdAttributeName(params: BrowserContextSetTestIdAttributeNameParams, progress: Progress): Promise; + setExtraHTTPHeaders(params: BrowserContextSetExtraHTTPHeadersParams, progress: Progress): Promise; + setGeolocation(params: BrowserContextSetGeolocationParams, progress: Progress): Promise; + setHTTPCredentials(params: BrowserContextSetHTTPCredentialsParams, progress: Progress): Promise; + setNetworkInterceptionPatterns(params: BrowserContextSetNetworkInterceptionPatternsParams, progress: Progress): Promise; + setWebSocketInterceptionPatterns(params: BrowserContextSetWebSocketInterceptionPatternsParams, progress: Progress): Promise; + setOffline(params: BrowserContextSetOfflineParams, progress: Progress): Promise; + storageState(params: BrowserContextStorageStateParams, progress: Progress): Promise; + setStorageState(params: BrowserContextSetStorageStateParams, progress: Progress): Promise; + pause(params: BrowserContextPauseParams, progress: Progress): Promise; + enableRecorder(params: BrowserContextEnableRecorderParams, progress: Progress): Promise; + disableRecorder(params: BrowserContextDisableRecorderParams, progress: Progress): Promise; + exposeConsoleApi(params: BrowserContextExposeConsoleApiParams, progress: Progress): Promise; + newCDPSession(params: BrowserContextNewCDPSessionParams, progress: Progress): Promise; + createTempFiles(params: BrowserContextCreateTempFilesParams, progress: Progress): Promise; + updateSubscription(params: BrowserContextUpdateSubscriptionParams, progress: Progress): Promise; + clockFastForward(params: BrowserContextClockFastForwardParams, progress: Progress): Promise; + clockInstall(params: BrowserContextClockInstallParams, progress: Progress): Promise; + clockPauseAt(params: BrowserContextClockPauseAtParams, progress: Progress): Promise; + clockResume(params: BrowserContextClockResumeParams, progress: Progress): Promise; + clockRunFor(params: BrowserContextClockRunForParams, progress: Progress): Promise; + clockSetFixedTime(params: BrowserContextClockSetFixedTimeParams, progress: Progress): Promise; + clockSetSystemTime(params: BrowserContextClockSetSystemTimeParams, progress: Progress): Promise; + credentialsInstall(params: BrowserContextCredentialsInstallParams, progress: Progress): Promise; + credentialsCreate(params: BrowserContextCredentialsCreateParams, progress: Progress): Promise; + credentialsGet(params: BrowserContextCredentialsGetParams, progress: Progress): Promise; + credentialsDelete(params: BrowserContextCredentialsDeleteParams, progress: Progress): Promise; +} +export type BrowserContextBindingCallEvent = { + binding: BindingCallChannel, +}; +export type BrowserContextConsoleEvent = { + type: string, + text: string, + args: JSHandleChannel[], + location: { + url: string, + lineNumber: number, + columnNumber: number, + }, + timestamp: number, + page?: PageChannel, + worker?: WorkerChannel, +}; +export type BrowserContextCloseEvent = {}; +export type BrowserContextDialogEvent = { + dialog: DialogChannel, +}; +export type BrowserContextPageEvent = { + page: PageChannel, +}; +export type BrowserContextPageErrorEvent = { + error: SerializedError, + page: PageChannel, + location: { + url: string, + line: number, + column: number, + }, +}; +export type BrowserContextRouteEvent = { + route: RouteChannel, +}; +export type BrowserContextWebSocketRouteEvent = { + webSocketRoute: WebSocketRouteChannel, +}; +export type BrowserContextServiceWorkerEvent = { + worker: WorkerChannel, +}; +export type BrowserContextRequestEvent = { + request: RequestChannel, + page?: PageChannel, +}; +export type BrowserContextRequestFailedEvent = { + request: RequestChannel, + failureText?: string, + responseEndTiming: number, + page?: PageChannel, +}; +export type BrowserContextRequestFinishedEvent = { + request: RequestChannel, + response?: ResponseChannel, + responseEndTiming: number, + page?: PageChannel, +}; +export type BrowserContextResponseEvent = { + response: ResponseChannel, + page?: PageChannel, +}; +export type BrowserContextRecorderEventEvent = { + event: 'actionAdded' | 'actionUpdated' | 'signalAdded', + data: any, + page: PageChannel, + code: string, +}; +export type BrowserContextAddCookiesParams = { + cookies: SetNetworkCookie[], +}; +export type BrowserContextAddCookiesOptions = { + +}; +export type BrowserContextAddCookiesResult = void; +export type BrowserContextAddInitScriptParams = { + source: string, +}; +export type BrowserContextAddInitScriptOptions = { + +}; +export type BrowserContextAddInitScriptResult = { + disposable: DisposableChannel, +}; +export type BrowserContextClearCookiesParams = { + name?: string, + nameRegexSource?: string, + nameRegexFlags?: string, + domain?: string, + domainRegexSource?: string, + domainRegexFlags?: string, + path?: string, + pathRegexSource?: string, + pathRegexFlags?: string, +}; +export type BrowserContextClearCookiesOptions = { + name?: string, + nameRegexSource?: string, + nameRegexFlags?: string, + domain?: string, + domainRegexSource?: string, + domainRegexFlags?: string, + path?: string, + pathRegexSource?: string, + pathRegexFlags?: string, +}; +export type BrowserContextClearCookiesResult = void; +export type BrowserContextClearPermissionsParams = {}; +export type BrowserContextClearPermissionsOptions = {}; +export type BrowserContextClearPermissionsResult = void; +export type BrowserContextCloseParams = { + reason?: string, +}; +export type BrowserContextCloseOptions = { + reason?: string, +}; +export type BrowserContextCloseResult = void; +export type BrowserContextCookiesParams = { + urls: string[], +}; +export type BrowserContextCookiesOptions = { + +}; +export type BrowserContextCookiesResult = { + cookies: NetworkCookie[], +}; +export type BrowserContextExposeBindingParams = { + name: string, +}; +export type BrowserContextExposeBindingOptions = { + +}; +export type BrowserContextExposeBindingResult = { + disposable: DisposableChannel, +}; +export type BrowserContextGrantPermissionsParams = { + permissions: string[], + origin?: string, +}; +export type BrowserContextGrantPermissionsOptions = { + origin?: string, +}; +export type BrowserContextGrantPermissionsResult = void; +export type BrowserContextNewPageParams = {}; +export type BrowserContextNewPageOptions = {}; +export type BrowserContextNewPageResult = { + page: PageChannel, +}; +export type BrowserContextRegisterSelectorEngineParams = { + selectorEngine: SelectorEngine, +}; +export type BrowserContextRegisterSelectorEngineOptions = { + +}; +export type BrowserContextRegisterSelectorEngineResult = void; +export type BrowserContextSetTestIdAttributeNameParams = { + testIdAttributeName: string, +}; +export type BrowserContextSetTestIdAttributeNameOptions = { + +}; +export type BrowserContextSetTestIdAttributeNameResult = void; +export type BrowserContextSetExtraHTTPHeadersParams = { + headers: NameValue[], +}; +export type BrowserContextSetExtraHTTPHeadersOptions = { + +}; +export type BrowserContextSetExtraHTTPHeadersResult = void; +export type BrowserContextSetGeolocationParams = { + geolocation?: { + longitude: number, + latitude: number, + accuracy?: number, + }, +}; +export type BrowserContextSetGeolocationOptions = { + geolocation?: { + longitude: number, + latitude: number, + accuracy?: number, + }, +}; +export type BrowserContextSetGeolocationResult = void; +export type BrowserContextSetHTTPCredentialsParams = { + httpCredentials?: { + username: string, + password: string, + origin?: string, + }, +}; +export type BrowserContextSetHTTPCredentialsOptions = { + httpCredentials?: { + username: string, + password: string, + origin?: string, + }, +}; +export type BrowserContextSetHTTPCredentialsResult = void; +export type BrowserContextSetNetworkInterceptionPatternsParams = { + patterns: { + glob?: string, + regexSource?: string, + regexFlags?: string, + urlPattern?: URLPattern, + }[], +}; +export type BrowserContextSetNetworkInterceptionPatternsOptions = { + +}; +export type BrowserContextSetNetworkInterceptionPatternsResult = void; +export type BrowserContextSetWebSocketInterceptionPatternsParams = { + patterns: { + glob?: string, + regexSource?: string, + regexFlags?: string, + urlPattern?: URLPattern, + }[], +}; +export type BrowserContextSetWebSocketInterceptionPatternsOptions = { + +}; +export type BrowserContextSetWebSocketInterceptionPatternsResult = void; +export type BrowserContextSetOfflineParams = { + offline: boolean, +}; +export type BrowserContextSetOfflineOptions = { + +}; +export type BrowserContextSetOfflineResult = void; +export type BrowserContextStorageStateParams = { + indexedDB?: boolean, +}; +export type BrowserContextStorageStateOptions = { + indexedDB?: boolean, +}; +export type BrowserContextStorageStateResult = { + cookies: NetworkCookie[], + origins: OriginStorage[], +}; +export type BrowserContextSetStorageStateParams = { + storageState?: { + cookies?: SetNetworkCookie[], + origins?: SetOriginStorage[], + }, +}; +export type BrowserContextSetStorageStateOptions = { + storageState?: { + cookies?: SetNetworkCookie[], + origins?: SetOriginStorage[], + }, +}; +export type BrowserContextSetStorageStateResult = void; +export type BrowserContextPauseParams = {}; +export type BrowserContextPauseOptions = {}; +export type BrowserContextPauseResult = void; +export type BrowserContextEnableRecorderParams = { + language?: string, + mode?: 'inspecting' | 'recording', + recorderMode?: 'default' | 'api', + pauseOnNextStatement?: boolean, + testIdAttributeName?: string, + launchOptions?: any, + contextOptions?: any, + device?: string, + saveStorage?: string, + outputFile?: string, + handleSIGINT?: boolean, + omitCallTracking?: boolean, +}; +export type BrowserContextEnableRecorderOptions = { + language?: string, + mode?: 'inspecting' | 'recording', + recorderMode?: 'default' | 'api', + pauseOnNextStatement?: boolean, + testIdAttributeName?: string, + launchOptions?: any, + contextOptions?: any, + device?: string, + saveStorage?: string, + outputFile?: string, + handleSIGINT?: boolean, + omitCallTracking?: boolean, +}; +export type BrowserContextEnableRecorderResult = void; +export type BrowserContextDisableRecorderParams = {}; +export type BrowserContextDisableRecorderOptions = {}; +export type BrowserContextDisableRecorderResult = void; +export type BrowserContextExposeConsoleApiParams = {}; +export type BrowserContextExposeConsoleApiOptions = {}; +export type BrowserContextExposeConsoleApiResult = void; +export type BrowserContextNewCDPSessionParams = { + page?: PageChannel, + frame?: FrameChannel, +}; +export type BrowserContextNewCDPSessionOptions = { + page?: PageChannel, + frame?: FrameChannel, +}; +export type BrowserContextNewCDPSessionResult = { + session: CDPSessionChannel, +}; +export type BrowserContextCreateTempFilesParams = { + rootDirName?: string, + items: { + name: string, + lastModifiedMs?: number, + }[], +}; +export type BrowserContextCreateTempFilesOptions = { + rootDirName?: string, +}; +export type BrowserContextCreateTempFilesResult = { + rootDir?: WritableStreamChannel, + writableStreams: WritableStreamChannel[], +}; +export type BrowserContextUpdateSubscriptionParams = { + event: 'console' | 'dialog' | 'request' | 'response' | 'requestFinished' | 'requestFailed', + enabled: boolean, +}; +export type BrowserContextUpdateSubscriptionOptions = { + +}; +export type BrowserContextUpdateSubscriptionResult = void; +export type BrowserContextClockFastForwardParams = { + ticksNumber?: number, + ticksString?: string, +}; +export type BrowserContextClockFastForwardOptions = { + ticksNumber?: number, + ticksString?: string, +}; +export type BrowserContextClockFastForwardResult = void; +export type BrowserContextClockInstallParams = { + timeNumber?: number, + timeString?: string, +}; +export type BrowserContextClockInstallOptions = { + timeNumber?: number, + timeString?: string, +}; +export type BrowserContextClockInstallResult = void; +export type BrowserContextClockPauseAtParams = { + timeNumber?: number, + timeString?: string, +}; +export type BrowserContextClockPauseAtOptions = { + timeNumber?: number, + timeString?: string, +}; +export type BrowserContextClockPauseAtResult = void; +export type BrowserContextClockResumeParams = {}; +export type BrowserContextClockResumeOptions = {}; +export type BrowserContextClockResumeResult = void; +export type BrowserContextClockRunForParams = { + ticksNumber?: number, + ticksString?: string, +}; +export type BrowserContextClockRunForOptions = { + ticksNumber?: number, + ticksString?: string, +}; +export type BrowserContextClockRunForResult = void; +export type BrowserContextClockSetFixedTimeParams = { + timeNumber?: number, + timeString?: string, +}; +export type BrowserContextClockSetFixedTimeOptions = { + timeNumber?: number, + timeString?: string, +}; +export type BrowserContextClockSetFixedTimeResult = void; +export type BrowserContextClockSetSystemTimeParams = { + timeNumber?: number, + timeString?: string, +}; +export type BrowserContextClockSetSystemTimeOptions = { + timeNumber?: number, + timeString?: string, +}; +export type BrowserContextClockSetSystemTimeResult = void; +export type BrowserContextCredentialsInstallParams = {}; +export type BrowserContextCredentialsInstallOptions = {}; +export type BrowserContextCredentialsInstallResult = void; +export type BrowserContextCredentialsCreateParams = { + rpId: string, + id?: string, + userHandle?: string, + privateKey?: string, + publicKey?: string, +}; +export type BrowserContextCredentialsCreateOptions = { + id?: string, + userHandle?: string, + privateKey?: string, + publicKey?: string, +}; +export type BrowserContextCredentialsCreateResult = { + credential: VirtualCredential, +}; +export type BrowserContextCredentialsGetParams = { + rpId?: string, + id?: string, +}; +export type BrowserContextCredentialsGetOptions = { + rpId?: string, + id?: string, +}; +export type BrowserContextCredentialsGetResult = { + credentials: VirtualCredential[], +}; +export type BrowserContextCredentialsDeleteParams = { + id: string, +}; +export type BrowserContextCredentialsDeleteOptions = { + +}; +export type BrowserContextCredentialsDeleteResult = void; + +export interface BrowserContextEvents { + 'bindingCall': BrowserContextBindingCallEvent; + 'console': BrowserContextConsoleEvent; + 'close': BrowserContextCloseEvent; + 'dialog': BrowserContextDialogEvent; + 'page': BrowserContextPageEvent; + 'pageError': BrowserContextPageErrorEvent; + 'route': BrowserContextRouteEvent; + 'webSocketRoute': BrowserContextWebSocketRouteEvent; + 'serviceWorker': BrowserContextServiceWorkerEvent; + 'request': BrowserContextRequestEvent; + 'requestFailed': BrowserContextRequestFailedEvent; + 'requestFinished': BrowserContextRequestFinishedEvent; + 'response': BrowserContextResponseEvent; + 'recorderEvent': BrowserContextRecorderEventEvent; +} + +// ----------- BrowserType ----------- +export type BrowserTypeInitializer = { + executablePath: string, + name: string, +}; +export interface BrowserTypeEventTarget { +} +export interface BrowserTypeChannel extends BrowserTypeEventTarget, Channel { + _type_BrowserType: boolean; + launch(params: BrowserTypeLaunchParams, progress: Progress): Promise; + launchPersistentContext(params: BrowserTypeLaunchPersistentContextParams, progress: Progress): Promise; + connectOverCDP(params: BrowserTypeConnectOverCDPParams, progress: Progress): Promise; + connectToWorker(params: BrowserTypeConnectToWorkerParams, progress: Progress): Promise; +} +export type BrowserTypeLaunchParams = { + channel?: string, + executablePath?: string, + args?: string[], + ignoreAllDefaultArgs?: boolean, + ignoreDefaultArgs?: string[], + handleSIGINT?: boolean, + handleSIGTERM?: boolean, + handleSIGHUP?: boolean, + timeout: number, + env?: NameValue[], + headless?: boolean, + proxy?: { + server: string, + bypass?: string, + username?: string, + password?: string, + }, + downloadsPath?: string, + tracesDir?: string, + artifactsDir?: string, + chromiumSandbox?: boolean, + firefoxUserPrefs?: any, + cdpPort?: number, + slowMo?: number, +}; +export type BrowserTypeLaunchOptions = { + channel?: string, + executablePath?: string, + args?: string[], + ignoreAllDefaultArgs?: boolean, + ignoreDefaultArgs?: string[], + handleSIGINT?: boolean, + handleSIGTERM?: boolean, + handleSIGHUP?: boolean, + env?: NameValue[], + headless?: boolean, + proxy?: { + server: string, + bypass?: string, + username?: string, + password?: string, + }, + downloadsPath?: string, + tracesDir?: string, + artifactsDir?: string, + chromiumSandbox?: boolean, + firefoxUserPrefs?: any, + cdpPort?: number, + slowMo?: number, +}; +export type BrowserTypeLaunchResult = { + browser: BrowserChannel, +}; +export type BrowserTypeLaunchPersistentContextParams = { + channel?: string, + executablePath?: string, + args?: string[], + ignoreAllDefaultArgs?: boolean, + ignoreDefaultArgs?: string[], + handleSIGINT?: boolean, + handleSIGTERM?: boolean, + handleSIGHUP?: boolean, + timeout: number, + env?: NameValue[], + headless?: boolean, + proxy?: { + server: string, + bypass?: string, + username?: string, + password?: string, + }, + downloadsPath?: string, + tracesDir?: string, + artifactsDir?: string, + chromiumSandbox?: boolean, + firefoxUserPrefs?: any, + cdpPort?: number, + noDefaultViewport?: boolean, + viewport?: { + width: number, + height: number, + }, + screen?: { + width: number, + height: number, + }, + ignoreHTTPSErrors?: boolean, + clientCertificates?: { + origin: string, + cert?: Binary, + key?: Binary, + passphrase?: string, + pfx?: Binary, + }[], + javaScriptEnabled?: boolean, + bypassCSP?: boolean, + userAgent?: string, + locale?: string, + timezoneId?: string, + geolocation?: { + longitude: number, + latitude: number, + accuracy?: number, + }, + permissions?: string[], + extraHTTPHeaders?: NameValue[], + offline?: boolean, + httpCredentials?: { + username: string, + password: string, + origin?: string, + send?: 'always' | 'unauthorized', + }, + deviceScaleFactor?: number, + isMobile?: boolean, + hasTouch?: boolean, + colorScheme?: 'dark' | 'light' | 'no-preference' | 'no-override', + reducedMotion?: 'reduce' | 'no-preference' | 'no-override', + forcedColors?: 'active' | 'none' | 'no-override', + acceptDownloads?: 'accept' | 'deny' | 'internal-browser-default', + contrast?: 'no-preference' | 'more' | 'no-override', + baseURL?: string, + recordVideo?: { + dir?: string, + size?: { + width: number, + height: number, + }, + showActions?: { + duration?: number, + position?: 'top-left' | 'top' | 'top-right' | 'bottom-left' | 'bottom' | 'bottom-right', + fontSize?: number, + cursor?: 'none' | 'pointer', + }, + }, + strictSelectors?: boolean, + serviceWorkers?: 'allow' | 'block', + selectorEngines?: SelectorEngine[], + testIdAttributeName?: string, + userDataDir: string, + slowMo?: number, +}; +export type BrowserTypeLaunchPersistentContextOptions = { + channel?: string, + executablePath?: string, + args?: string[], + ignoreAllDefaultArgs?: boolean, + ignoreDefaultArgs?: string[], + handleSIGINT?: boolean, + handleSIGTERM?: boolean, + handleSIGHUP?: boolean, + env?: NameValue[], + headless?: boolean, + proxy?: { + server: string, + bypass?: string, + username?: string, + password?: string, + }, + downloadsPath?: string, + tracesDir?: string, + artifactsDir?: string, + chromiumSandbox?: boolean, + firefoxUserPrefs?: any, + cdpPort?: number, + noDefaultViewport?: boolean, + viewport?: { + width: number, + height: number, + }, + screen?: { + width: number, + height: number, + }, + ignoreHTTPSErrors?: boolean, + clientCertificates?: { + origin: string, + cert?: Binary, + key?: Binary, + passphrase?: string, + pfx?: Binary, + }[], + javaScriptEnabled?: boolean, + bypassCSP?: boolean, + userAgent?: string, + locale?: string, + timezoneId?: string, + geolocation?: { + longitude: number, + latitude: number, + accuracy?: number, + }, + permissions?: string[], + extraHTTPHeaders?: NameValue[], + offline?: boolean, + httpCredentials?: { + username: string, + password: string, + origin?: string, + send?: 'always' | 'unauthorized', + }, + deviceScaleFactor?: number, + isMobile?: boolean, + hasTouch?: boolean, + colorScheme?: 'dark' | 'light' | 'no-preference' | 'no-override', + reducedMotion?: 'reduce' | 'no-preference' | 'no-override', + forcedColors?: 'active' | 'none' | 'no-override', + acceptDownloads?: 'accept' | 'deny' | 'internal-browser-default', + contrast?: 'no-preference' | 'more' | 'no-override', + baseURL?: string, + recordVideo?: { + dir?: string, + size?: { + width: number, + height: number, + }, + showActions?: { + duration?: number, + position?: 'top-left' | 'top' | 'top-right' | 'bottom-left' | 'bottom' | 'bottom-right', + fontSize?: number, + cursor?: 'none' | 'pointer', + }, + }, + strictSelectors?: boolean, + serviceWorkers?: 'allow' | 'block', + selectorEngines?: SelectorEngine[], + testIdAttributeName?: string, + slowMo?: number, +}; +export type BrowserTypeLaunchPersistentContextResult = { + browser: BrowserChannel, + context: BrowserContextChannel, +}; +export type BrowserTypeConnectOverCDPParams = { + endpointURL?: string, + headers?: NameValue[], + slowMo?: number, + timeout: number, + isLocal?: boolean, + noDefaults?: boolean, + artifactsDir?: string, + transport?: Binary, +}; +export type BrowserTypeConnectOverCDPOptions = { + endpointURL?: string, + headers?: NameValue[], + slowMo?: number, + isLocal?: boolean, + noDefaults?: boolean, + artifactsDir?: string, + transport?: Binary, +}; +export type BrowserTypeConnectOverCDPResult = { + browser: BrowserChannel, + defaultContext?: BrowserContextChannel, +}; +export type BrowserTypeConnectToWorkerParams = { + endpoint: string, + timeout: number, +}; +export type BrowserTypeConnectToWorkerOptions = { + +}; +export type BrowserTypeConnectToWorkerResult = { + worker: WorkerChannel, +}; + +export interface BrowserTypeEvents { +} + +export type Metadata = { + location?: { + file: string, + line?: number, + column?: number, + }, + title?: string, + internal?: boolean, + stepId?: string, +}; + +export type ClientSideCallMetadata = { + id: number, + stack?: StackFrame[], +}; + +export type SDKLanguage = 'javascript' | 'python' | 'java' | 'csharp'; +// ----------- Disposable ----------- +export type DisposableInitializer = {}; +export interface DisposableEventTarget { +} +export interface DisposableChannel extends DisposableEventTarget, Channel { + _type_Disposable: boolean; + dispose(params: DisposableDisposeParams, progress: Progress): Promise; +} +export type DisposableDisposeParams = {}; +export type DisposableDisposeOptions = {}; +export type DisposableDisposeResult = void; + +export interface DisposableEvents { +} + +export type WaitInfo = { + waitId: string, + phase: 'before' | 'after' | 'log', + event?: string, + message?: string, + error?: string, +}; + +// ----------- Electron ----------- +export type ElectronInitializer = {}; +export interface ElectronEventTarget { +} +export interface ElectronChannel extends ElectronEventTarget, Channel { + _type_Electron: boolean; + launch(params: ElectronLaunchParams, progress: Progress): Promise; +} +export type ElectronLaunchParams = { + executablePath?: string, + args?: string[], + chromiumSandbox?: boolean, + cwd?: string, + env?: NameValue[], + timeout: number, + acceptDownloads?: 'accept' | 'deny' | 'internal-browser-default', + bypassCSP?: boolean, + colorScheme?: 'dark' | 'light' | 'no-preference' | 'no-override', + extraHTTPHeaders?: NameValue[], + geolocation?: { + longitude: number, + latitude: number, + accuracy?: number, + }, + httpCredentials?: { + username: string, + password: string, + origin?: string, + }, + ignoreHTTPSErrors?: boolean, + locale?: string, + offline?: boolean, + recordVideo?: { + dir?: string, + size?: { + width: number, + height: number, + }, + showActions?: { + duration?: number, + position?: 'top-left' | 'top' | 'top-right' | 'bottom-left' | 'bottom' | 'bottom-right', + fontSize?: number, + cursor?: 'none' | 'pointer', + }, + }, + strictSelectors?: boolean, + timezoneId?: string, + tracesDir?: string, + artifactsDir?: string, + selectorEngines?: SelectorEngine[], + testIdAttributeName?: string, +}; +export type ElectronLaunchOptions = { + executablePath?: string, + args?: string[], + chromiumSandbox?: boolean, + cwd?: string, + env?: NameValue[], + acceptDownloads?: 'accept' | 'deny' | 'internal-browser-default', + bypassCSP?: boolean, + colorScheme?: 'dark' | 'light' | 'no-preference' | 'no-override', + extraHTTPHeaders?: NameValue[], + geolocation?: { + longitude: number, + latitude: number, + accuracy?: number, + }, + httpCredentials?: { + username: string, + password: string, + origin?: string, + }, + ignoreHTTPSErrors?: boolean, + locale?: string, + offline?: boolean, + recordVideo?: { + dir?: string, + size?: { + width: number, + height: number, + }, + showActions?: { + duration?: number, + position?: 'top-left' | 'top' | 'top-right' | 'bottom-left' | 'bottom' | 'bottom-right', + fontSize?: number, + cursor?: 'none' | 'pointer', + }, + }, + strictSelectors?: boolean, + timezoneId?: string, + tracesDir?: string, + artifactsDir?: string, + selectorEngines?: SelectorEngine[], + testIdAttributeName?: string, +}; +export type ElectronLaunchResult = { + electronApplication: ElectronApplicationChannel, +}; + +export interface ElectronEvents { +} + +// ----------- ElectronApplication ----------- +export type ElectronApplicationInitializer = { + context: BrowserContextChannel, +}; +export interface ElectronApplicationEventTarget { + _dispatchEvent(event: 'close', params?: ElectronApplicationCloseEvent): void; + _dispatchEvent(event: 'console', params?: ElectronApplicationConsoleEvent): void; +} +export interface ElectronApplicationChannel extends ElectronApplicationEventTarget, Channel { + _type_ElectronApplication: boolean; + browserWindow(params: ElectronApplicationBrowserWindowParams, progress: Progress): Promise; + evaluateExpression(params: ElectronApplicationEvaluateExpressionParams, progress: Progress): Promise; + evaluateExpressionHandle(params: ElectronApplicationEvaluateExpressionHandleParams, progress: Progress): Promise; + updateSubscription(params: ElectronApplicationUpdateSubscriptionParams, progress: Progress): Promise; +} +export type ElectronApplicationCloseEvent = {}; +export type ElectronApplicationConsoleEvent = { + type: string, + text: string, + args: JSHandleChannel[], + location: { + url: string, + lineNumber: number, + columnNumber: number, + }, + timestamp: number, +}; +export type ElectronApplicationBrowserWindowParams = { + page: PageChannel, +}; +export type ElectronApplicationBrowserWindowOptions = { + +}; +export type ElectronApplicationBrowserWindowResult = { + handle: JSHandleChannel, +}; +export type ElectronApplicationEvaluateExpressionParams = { + expression: string, + isFunction?: boolean, + arg: SerializedArgument, +}; +export type ElectronApplicationEvaluateExpressionOptions = { + isFunction?: boolean, +}; +export type ElectronApplicationEvaluateExpressionResult = { + value: SerializedValue, +}; +export type ElectronApplicationEvaluateExpressionHandleParams = { + expression: string, + isFunction?: boolean, + arg: SerializedArgument, +}; +export type ElectronApplicationEvaluateExpressionHandleOptions = { + isFunction?: boolean, +}; +export type ElectronApplicationEvaluateExpressionHandleResult = { + handle: JSHandleChannel, +}; +export type ElectronApplicationUpdateSubscriptionParams = { + event: 'console', + enabled: boolean, +}; +export type ElectronApplicationUpdateSubscriptionOptions = { + +}; +export type ElectronApplicationUpdateSubscriptionResult = void; + +export interface ElectronApplicationEvents { + 'close': ElectronApplicationCloseEvent; + 'console': ElectronApplicationConsoleEvent; +} + +// ----------- Frame ----------- +export type FrameInitializer = { + url: string, + name: string, + parentFrame?: FrameChannel, + loadStates: LifecycleEvent[], +}; +export interface FrameEventTarget { + _dispatchEvent(event: 'loadstate', params?: FrameLoadstateEvent): void; + _dispatchEvent(event: 'navigated', params?: FrameNavigatedEvent): void; +} +export interface FrameChannel extends FrameEventTarget, Channel { + _type_Frame: boolean; + evalOnSelector(params: FrameEvalOnSelectorParams, progress: Progress): Promise; + evalOnSelectorAll(params: FrameEvalOnSelectorAllParams, progress: Progress): Promise; + addScriptTag(params: FrameAddScriptTagParams, progress: Progress): Promise; + addStyleTag(params: FrameAddStyleTagParams, progress: Progress): Promise; + ariaSnapshot(params: FrameAriaSnapshotParams, progress: Progress): Promise; + blur(params: FrameBlurParams, progress: Progress): Promise; + check(params: FrameCheckParams, progress: Progress): Promise; + click(params: FrameClickParams, progress: Progress): Promise; + content(params: FrameContentParams, progress: Progress): Promise; + dragAndDrop(params: FrameDragAndDropParams, progress: Progress): Promise; + drop(params: FrameDropParams, progress: Progress): Promise; + dblclick(params: FrameDblclickParams, progress: Progress): Promise; + dispatchEvent(params: FrameDispatchEventParams, progress: Progress): Promise; + evaluateExpression(params: FrameEvaluateExpressionParams, progress: Progress): Promise; + evaluateExpressionHandle(params: FrameEvaluateExpressionHandleParams, progress: Progress): Promise; + fill(params: FrameFillParams, progress: Progress): Promise; + focus(params: FrameFocusParams, progress: Progress): Promise; + frameElement(params: FrameFrameElementParams, progress: Progress): Promise; + resolveSelector(params: FrameResolveSelectorParams, progress: Progress): Promise; + highlight(params: FrameHighlightParams, progress: Progress): Promise; + hideHighlight(params: FrameHideHighlightParams, progress: Progress): Promise; + getAttribute(params: FrameGetAttributeParams, progress: Progress): Promise; + goto(params: FrameGotoParams, progress: Progress): Promise; + hover(params: FrameHoverParams, progress: Progress): Promise; + innerHTML(params: FrameInnerHTMLParams, progress: Progress): Promise; + innerText(params: FrameInnerTextParams, progress: Progress): Promise; + inputValue(params: FrameInputValueParams, progress: Progress): Promise; + isChecked(params: FrameIsCheckedParams, progress: Progress): Promise; + isDisabled(params: FrameIsDisabledParams, progress: Progress): Promise; + isEnabled(params: FrameIsEnabledParams, progress: Progress): Promise; + isHidden(params: FrameIsHiddenParams, progress: Progress): Promise; + isVisible(params: FrameIsVisibleParams, progress: Progress): Promise; + isEditable(params: FrameIsEditableParams, progress: Progress): Promise; + press(params: FramePressParams, progress: Progress): Promise; + querySelector(params: FrameQuerySelectorParams, progress: Progress): Promise; + querySelectorAll(params: FrameQuerySelectorAllParams, progress: Progress): Promise; + queryCount(params: FrameQueryCountParams, progress: Progress): Promise; + selectOption(params: FrameSelectOptionParams, progress: Progress): Promise; + setContent(params: FrameSetContentParams, progress: Progress): Promise; + setInputFiles(params: FrameSetInputFilesParams, progress: Progress): Promise; + tap(params: FrameTapParams, progress: Progress): Promise; + textContent(params: FrameTextContentParams, progress: Progress): Promise; + title(params: FrameTitleParams, progress: Progress): Promise; + type(params: FrameTypeParams, progress: Progress): Promise; + uncheck(params: FrameUncheckParams, progress: Progress): Promise; + waitForTimeout(params: FrameWaitForTimeoutParams, progress: Progress): Promise; + waitForFunction(params: FrameWaitForFunctionParams, progress: Progress): Promise; + waitForSelector(params: FrameWaitForSelectorParams, progress: Progress): Promise; + expect(params: FrameExpectParams, progress: Progress): Promise; +} +export type FrameLoadstateEvent = { + add?: LifecycleEvent, + remove?: LifecycleEvent, +}; +export type FrameNavigatedEvent = { + url: string, + name: string, + newDocument?: { + request?: RequestChannel, + }, + error?: string, +}; +export type FrameEvalOnSelectorParams = { + selector: string, + strict?: boolean, + expression: string, + isFunction?: boolean, + arg: SerializedArgument, +}; +export type FrameEvalOnSelectorOptions = { + strict?: boolean, + isFunction?: boolean, +}; +export type FrameEvalOnSelectorResult = { + value: SerializedValue, +}; +export type FrameEvalOnSelectorAllParams = { + selector: string, + expression: string, + isFunction?: boolean, + arg: SerializedArgument, +}; +export type FrameEvalOnSelectorAllOptions = { + isFunction?: boolean, +}; +export type FrameEvalOnSelectorAllResult = { + value: SerializedValue, +}; +export type FrameAddScriptTagParams = { + url?: string, + content?: string, + type?: string, +}; +export type FrameAddScriptTagOptions = { + url?: string, + content?: string, + type?: string, +}; +export type FrameAddScriptTagResult = { + element: ElementHandleChannel, +}; +export type FrameAddStyleTagParams = { + url?: string, + content?: string, +}; +export type FrameAddStyleTagOptions = { + url?: string, + content?: string, +}; +export type FrameAddStyleTagResult = { + element: ElementHandleChannel, +}; +export type FrameAriaSnapshotParams = { + mode?: 'ai' | 'default', + track?: string, + selector?: string, + depth?: number, + boxes?: boolean, + timeout: number, +}; +export type FrameAriaSnapshotOptions = { + mode?: 'ai' | 'default', + track?: string, + selector?: string, + depth?: number, + boxes?: boolean, +}; +export type FrameAriaSnapshotResult = { + snapshot: string, +}; +export type FrameBlurParams = { + selector: string, + strict?: boolean, + timeout: number, +}; +export type FrameBlurOptions = { + strict?: boolean, +}; +export type FrameBlurResult = void; +export type FrameCheckParams = { + selector: string, + strict?: boolean, + force?: boolean, + position?: Point, + timeout: number, + trial?: boolean, +}; +export type FrameCheckOptions = { + strict?: boolean, + force?: boolean, + position?: Point, + trial?: boolean, +}; +export type FrameCheckResult = void; +export type FrameClickParams = { + selector: string, + strict?: boolean, + force?: boolean, + noWaitAfter?: boolean, + modifiers?: ('Alt' | 'Control' | 'ControlOrMeta' | 'Meta' | 'Shift')[], + position?: Point, + delay?: number, + button?: 'left' | 'right' | 'middle', + clickCount?: number, + timeout: number, + trial?: boolean, + steps?: number, +}; +export type FrameClickOptions = { + strict?: boolean, + force?: boolean, + noWaitAfter?: boolean, + modifiers?: ('Alt' | 'Control' | 'ControlOrMeta' | 'Meta' | 'Shift')[], + position?: Point, + delay?: number, + button?: 'left' | 'right' | 'middle', + clickCount?: number, + trial?: boolean, + steps?: number, +}; +export type FrameClickResult = void; +export type FrameContentParams = {}; +export type FrameContentOptions = {}; +export type FrameContentResult = { + value: string, +}; +export type FrameDragAndDropParams = { + source: string, + target: string, + force?: boolean, + timeout: number, + trial?: boolean, + sourcePosition?: Point, + targetPosition?: Point, + strict?: boolean, + steps?: number, +}; +export type FrameDragAndDropOptions = { + force?: boolean, + trial?: boolean, + sourcePosition?: Point, + targetPosition?: Point, + strict?: boolean, + steps?: number, +}; +export type FrameDragAndDropResult = void; +export type FrameDropParams = { + selector: string, + strict?: boolean, + position?: Point, + payloads?: { + name: string, + mimeType?: string, + buffer: Binary, + }[], + localPaths?: string[], + streams?: WritableStreamChannel[], + data?: { + mimeType: string, + value: string, + }[], + timeout: number, +}; +export type FrameDropOptions = { + strict?: boolean, + position?: Point, + payloads?: { + name: string, + mimeType?: string, + buffer: Binary, + }[], + localPaths?: string[], + streams?: WritableStreamChannel[], + data?: { + mimeType: string, + value: string, + }[], +}; +export type FrameDropResult = void; +export type FrameDblclickParams = { + selector: string, + strict?: boolean, + force?: boolean, + modifiers?: ('Alt' | 'Control' | 'ControlOrMeta' | 'Meta' | 'Shift')[], + position?: Point, + delay?: number, + button?: 'left' | 'right' | 'middle', + timeout: number, + trial?: boolean, + steps?: number, +}; +export type FrameDblclickOptions = { + strict?: boolean, + force?: boolean, + modifiers?: ('Alt' | 'Control' | 'ControlOrMeta' | 'Meta' | 'Shift')[], + position?: Point, + delay?: number, + button?: 'left' | 'right' | 'middle', + trial?: boolean, + steps?: number, +}; +export type FrameDblclickResult = void; +export type FrameDispatchEventParams = { + selector: string, + strict?: boolean, + type: string, + eventInit: SerializedArgument, + timeout: number, +}; +export type FrameDispatchEventOptions = { + strict?: boolean, +}; +export type FrameDispatchEventResult = void; +export type FrameEvaluateExpressionParams = { + expression: string, + isFunction?: boolean, + arg: SerializedArgument, +}; +export type FrameEvaluateExpressionOptions = { + isFunction?: boolean, +}; +export type FrameEvaluateExpressionResult = { + value: SerializedValue, +}; +export type FrameEvaluateExpressionHandleParams = { + expression: string, + isFunction?: boolean, + arg: SerializedArgument, +}; +export type FrameEvaluateExpressionHandleOptions = { + isFunction?: boolean, +}; +export type FrameEvaluateExpressionHandleResult = { + handle: JSHandleChannel, +}; +export type FrameFillParams = { + selector: string, + strict?: boolean, + value: string, + force?: boolean, + timeout: number, +}; +export type FrameFillOptions = { + strict?: boolean, + force?: boolean, +}; +export type FrameFillResult = void; +export type FrameFocusParams = { + selector: string, + strict?: boolean, + timeout: number, +}; +export type FrameFocusOptions = { + strict?: boolean, +}; +export type FrameFocusResult = void; +export type FrameFrameElementParams = {}; +export type FrameFrameElementOptions = {}; +export type FrameFrameElementResult = { + element: ElementHandleChannel, +}; +export type FrameResolveSelectorParams = { + selector: string, +}; +export type FrameResolveSelectorOptions = { + +}; +export type FrameResolveSelectorResult = { + resolvedSelector: string, +}; +export type FrameHighlightParams = { + selector: string, + style?: string, +}; +export type FrameHighlightOptions = { + style?: string, +}; +export type FrameHighlightResult = void; +export type FrameHideHighlightParams = { + selector: string, +}; +export type FrameHideHighlightOptions = { + +}; +export type FrameHideHighlightResult = void; +export type FrameGetAttributeParams = { + selector: string, + strict?: boolean, + name: string, + timeout: number, +}; +export type FrameGetAttributeOptions = { + strict?: boolean, +}; +export type FrameGetAttributeResult = { + value?: string, +}; +export type FrameGotoParams = { + url: string, + timeout: number, + waitUntil?: LifecycleEvent, + referer?: string, +}; +export type FrameGotoOptions = { + waitUntil?: LifecycleEvent, + referer?: string, +}; +export type FrameGotoResult = { + response?: ResponseChannel, +}; +export type FrameHoverParams = { + selector: string, + strict?: boolean, + force?: boolean, + modifiers?: ('Alt' | 'Control' | 'ControlOrMeta' | 'Meta' | 'Shift')[], + position?: Point, + timeout: number, + trial?: boolean, +}; +export type FrameHoverOptions = { + strict?: boolean, + force?: boolean, + modifiers?: ('Alt' | 'Control' | 'ControlOrMeta' | 'Meta' | 'Shift')[], + position?: Point, + trial?: boolean, +}; +export type FrameHoverResult = void; +export type FrameInnerHTMLParams = { + selector: string, + strict?: boolean, + timeout: number, +}; +export type FrameInnerHTMLOptions = { + strict?: boolean, +}; +export type FrameInnerHTMLResult = { + value: string, +}; +export type FrameInnerTextParams = { + selector: string, + strict?: boolean, + timeout: number, +}; +export type FrameInnerTextOptions = { + strict?: boolean, +}; +export type FrameInnerTextResult = { + value: string, +}; +export type FrameInputValueParams = { + selector: string, + strict?: boolean, + timeout: number, +}; +export type FrameInputValueOptions = { + strict?: boolean, +}; +export type FrameInputValueResult = { + value: string, +}; +export type FrameIsCheckedParams = { + selector: string, + strict?: boolean, + timeout: number, +}; +export type FrameIsCheckedOptions = { + strict?: boolean, +}; +export type FrameIsCheckedResult = { + value: boolean, +}; +export type FrameIsDisabledParams = { + selector: string, + strict?: boolean, + timeout: number, +}; +export type FrameIsDisabledOptions = { + strict?: boolean, +}; +export type FrameIsDisabledResult = { + value: boolean, +}; +export type FrameIsEnabledParams = { + selector: string, + strict?: boolean, + timeout: number, +}; +export type FrameIsEnabledOptions = { + strict?: boolean, +}; +export type FrameIsEnabledResult = { + value: boolean, +}; +export type FrameIsHiddenParams = { + selector: string, + strict?: boolean, +}; +export type FrameIsHiddenOptions = { + strict?: boolean, +}; +export type FrameIsHiddenResult = { + value: boolean, +}; +export type FrameIsVisibleParams = { + selector: string, + strict?: boolean, +}; +export type FrameIsVisibleOptions = { + strict?: boolean, +}; +export type FrameIsVisibleResult = { + value: boolean, +}; +export type FrameIsEditableParams = { + selector: string, + strict?: boolean, + timeout: number, +}; +export type FrameIsEditableOptions = { + strict?: boolean, +}; +export type FrameIsEditableResult = { + value: boolean, +}; +export type FramePressParams = { + selector: string, + strict?: boolean, + key: string, + delay?: number, + noWaitAfter?: boolean, + timeout: number, +}; +export type FramePressOptions = { + strict?: boolean, + delay?: number, + noWaitAfter?: boolean, +}; +export type FramePressResult = void; +export type FrameQuerySelectorParams = { + selector: string, + strict?: boolean, +}; +export type FrameQuerySelectorOptions = { + strict?: boolean, +}; +export type FrameQuerySelectorResult = { + element?: ElementHandleChannel, +}; +export type FrameQuerySelectorAllParams = { + selector: string, +}; +export type FrameQuerySelectorAllOptions = { + +}; +export type FrameQuerySelectorAllResult = { + elements: ElementHandleChannel[], +}; +export type FrameQueryCountParams = { + selector: string, +}; +export type FrameQueryCountOptions = { + +}; +export type FrameQueryCountResult = { + value: number, +}; +export type FrameSelectOptionParams = { + selector: string, + strict?: boolean, + elements?: ElementHandleChannel[], + options?: { + valueOrLabel?: string, + value?: string, + label?: string, + index?: number, + }[], + force?: boolean, + timeout: number, +}; +export type FrameSelectOptionOptions = { + strict?: boolean, + elements?: ElementHandleChannel[], + options?: { + valueOrLabel?: string, + value?: string, + label?: string, + index?: number, + }[], + force?: boolean, +}; +export type FrameSelectOptionResult = { + values: string[], +}; +export type FrameSetContentParams = { + html: string, + timeout: number, + waitUntil?: LifecycleEvent, +}; +export type FrameSetContentOptions = { + waitUntil?: LifecycleEvent, +}; +export type FrameSetContentResult = void; +export type FrameSetInputFilesParams = { + selector: string, + strict?: boolean, + payloads?: { + name: string, + mimeType?: string, + buffer: Binary, + }[], + localDirectory?: string, + directoryStream?: WritableStreamChannel, + localPaths?: string[], + streams?: WritableStreamChannel[], + timeout: number, +}; +export type FrameSetInputFilesOptions = { + strict?: boolean, + payloads?: { + name: string, + mimeType?: string, + buffer: Binary, + }[], + localDirectory?: string, + directoryStream?: WritableStreamChannel, + localPaths?: string[], + streams?: WritableStreamChannel[], +}; +export type FrameSetInputFilesResult = void; +export type FrameTapParams = { + selector: string, + strict?: boolean, + force?: boolean, + modifiers?: ('Alt' | 'Control' | 'ControlOrMeta' | 'Meta' | 'Shift')[], + position?: Point, + timeout: number, + trial?: boolean, +}; +export type FrameTapOptions = { + strict?: boolean, + force?: boolean, + modifiers?: ('Alt' | 'Control' | 'ControlOrMeta' | 'Meta' | 'Shift')[], + position?: Point, + trial?: boolean, +}; +export type FrameTapResult = void; +export type FrameTextContentParams = { + selector: string, + strict?: boolean, + timeout: number, +}; +export type FrameTextContentOptions = { + strict?: boolean, +}; +export type FrameTextContentResult = { + value?: string, +}; +export type FrameTitleParams = {}; +export type FrameTitleOptions = {}; +export type FrameTitleResult = { + value: string, +}; +export type FrameTypeParams = { + selector: string, + strict?: boolean, + text: string, + delay?: number, + timeout: number, +}; +export type FrameTypeOptions = { + strict?: boolean, + delay?: number, +}; +export type FrameTypeResult = void; +export type FrameUncheckParams = { + selector: string, + strict?: boolean, + force?: boolean, + position?: Point, + timeout: number, + trial?: boolean, +}; +export type FrameUncheckOptions = { + strict?: boolean, + force?: boolean, + position?: Point, + trial?: boolean, +}; +export type FrameUncheckResult = void; +export type FrameWaitForTimeoutParams = { + waitTimeout: number, +}; +export type FrameWaitForTimeoutOptions = { + +}; +export type FrameWaitForTimeoutResult = void; +export type FrameWaitForFunctionParams = { + expression: string, + isFunction?: boolean, + arg: SerializedArgument, + timeout: number, + pollingInterval?: number, +}; +export type FrameWaitForFunctionOptions = { + isFunction?: boolean, + pollingInterval?: number, +}; +export type FrameWaitForFunctionResult = { + handle: JSHandleChannel, +}; +export type FrameWaitForSelectorParams = { + selector: string, + strict?: boolean, + timeout: number, + state?: 'attached' | 'detached' | 'visible' | 'hidden', + omitReturnValue?: boolean, +}; +export type FrameWaitForSelectorOptions = { + strict?: boolean, + state?: 'attached' | 'detached' | 'visible' | 'hidden', + omitReturnValue?: boolean, +}; +export type FrameWaitForSelectorResult = { + element?: ElementHandleChannel, +}; +export type FrameExpectParams = { + selector?: string, + expression: string, + expressionArg?: any, + pseudo?: 'before' | 'after', + expectedText?: ExpectedTextValue[], + expectedNumber?: number, + expectedValue?: SerializedArgument, + useInnerText?: boolean, + isNot: boolean, + timeout: number, +}; +export type FrameExpectOptions = { + selector?: string, + expressionArg?: any, + pseudo?: 'before' | 'after', + expectedText?: ExpectedTextValue[], + expectedNumber?: number, + expectedValue?: SerializedArgument, + useInnerText?: boolean, +}; +export type FrameExpectResult = void; +export type FrameExpectErrorDetails = { + received?: { + value?: SerializedValue, + ariaSnapshot?: string, + }, + timedOut?: boolean, + customErrorMessage?: string, +}; + +export interface FrameEvents { + 'loadstate': FrameLoadstateEvent; + 'navigated': FrameNavigatedEvent; +} + +// ----------- JSHandle ----------- +export type JSHandleInitializer = { + preview: string, +}; +export interface JSHandleEventTarget { + _dispatchEvent(event: 'previewUpdated', params?: JSHandlePreviewUpdatedEvent): void; +} +export interface JSHandleChannel extends JSHandleEventTarget, Channel { + _type_JSHandle: boolean; + dispose(params: JSHandleDisposeParams, progress: Progress): Promise; + evaluateExpression(params: JSHandleEvaluateExpressionParams, progress: Progress): Promise; + evaluateExpressionHandle(params: JSHandleEvaluateExpressionHandleParams, progress: Progress): Promise; + getPropertyList(params: JSHandleGetPropertyListParams, progress: Progress): Promise; + getProperty(params: JSHandleGetPropertyParams, progress: Progress): Promise; + jsonValue(params: JSHandleJsonValueParams, progress: Progress): Promise; +} +export type JSHandlePreviewUpdatedEvent = { + preview: string, +}; +export type JSHandleDisposeParams = {}; +export type JSHandleDisposeOptions = {}; +export type JSHandleDisposeResult = void; +export type JSHandleEvaluateExpressionParams = { + expression: string, + isFunction?: boolean, + arg: SerializedArgument, +}; +export type JSHandleEvaluateExpressionOptions = { + isFunction?: boolean, +}; +export type JSHandleEvaluateExpressionResult = { + value: SerializedValue, +}; +export type JSHandleEvaluateExpressionHandleParams = { + expression: string, + isFunction?: boolean, + arg: SerializedArgument, +}; +export type JSHandleEvaluateExpressionHandleOptions = { + isFunction?: boolean, +}; +export type JSHandleEvaluateExpressionHandleResult = { + handle: JSHandleChannel, +}; +export type JSHandleGetPropertyListParams = {}; +export type JSHandleGetPropertyListOptions = {}; +export type JSHandleGetPropertyListResult = { + properties: { + name: string, + value: JSHandleChannel, + }[], +}; +export type JSHandleGetPropertyParams = { + name: string, +}; +export type JSHandleGetPropertyOptions = { + +}; +export type JSHandleGetPropertyResult = { + handle: JSHandleChannel, +}; +export type JSHandleJsonValueParams = {}; +export type JSHandleJsonValueOptions = {}; +export type JSHandleJsonValueResult = { + value: SerializedValue, +}; + +export interface JSHandleEvents { + 'previewUpdated': JSHandlePreviewUpdatedEvent; +} + +// ----------- ElementHandle ----------- +export type ElementHandleInitializer = {}; +export interface ElementHandleEventTarget { +} +export interface ElementHandleChannel extends ElementHandleEventTarget, JSHandleChannel { + _type_ElementHandle: boolean; + evalOnSelector(params: ElementHandleEvalOnSelectorParams, progress: Progress): Promise; + evalOnSelectorAll(params: ElementHandleEvalOnSelectorAllParams, progress: Progress): Promise; + boundingBox(params: ElementHandleBoundingBoxParams, progress: Progress): Promise; + check(params: ElementHandleCheckParams, progress: Progress): Promise; + click(params: ElementHandleClickParams, progress: Progress): Promise; + contentFrame(params: ElementHandleContentFrameParams, progress: Progress): Promise; + dblclick(params: ElementHandleDblclickParams, progress: Progress): Promise; + dispatchEvent(params: ElementHandleDispatchEventParams, progress: Progress): Promise; + fill(params: ElementHandleFillParams, progress: Progress): Promise; + focus(params: ElementHandleFocusParams, progress: Progress): Promise; + getAttribute(params: ElementHandleGetAttributeParams, progress: Progress): Promise; + hover(params: ElementHandleHoverParams, progress: Progress): Promise; + innerHTML(params: ElementHandleInnerHTMLParams, progress: Progress): Promise; + innerText(params: ElementHandleInnerTextParams, progress: Progress): Promise; + inputValue(params: ElementHandleInputValueParams, progress: Progress): Promise; + isChecked(params: ElementHandleIsCheckedParams, progress: Progress): Promise; + isDisabled(params: ElementHandleIsDisabledParams, progress: Progress): Promise; + isEditable(params: ElementHandleIsEditableParams, progress: Progress): Promise; + isEnabled(params: ElementHandleIsEnabledParams, progress: Progress): Promise; + isHidden(params: ElementHandleIsHiddenParams, progress: Progress): Promise; + isVisible(params: ElementHandleIsVisibleParams, progress: Progress): Promise; + ownerFrame(params: ElementHandleOwnerFrameParams, progress: Progress): Promise; + press(params: ElementHandlePressParams, progress: Progress): Promise; + querySelector(params: ElementHandleQuerySelectorParams, progress: Progress): Promise; + querySelectorAll(params: ElementHandleQuerySelectorAllParams, progress: Progress): Promise; + screenshot(params: ElementHandleScreenshotParams, progress: Progress): Promise; + scrollIntoViewIfNeeded(params: ElementHandleScrollIntoViewIfNeededParams, progress: Progress): Promise; + selectOption(params: ElementHandleSelectOptionParams, progress: Progress): Promise; + selectText(params: ElementHandleSelectTextParams, progress: Progress): Promise; + setInputFiles(params: ElementHandleSetInputFilesParams, progress: Progress): Promise; + tap(params: ElementHandleTapParams, progress: Progress): Promise; + textContent(params: ElementHandleTextContentParams, progress: Progress): Promise; + type(params: ElementHandleTypeParams, progress: Progress): Promise; + uncheck(params: ElementHandleUncheckParams, progress: Progress): Promise; + waitForElementState(params: ElementHandleWaitForElementStateParams, progress: Progress): Promise; + waitForSelector(params: ElementHandleWaitForSelectorParams, progress: Progress): Promise; +} +export type ElementHandleEvalOnSelectorParams = { + selector: string, + strict?: boolean, + expression: string, + isFunction?: boolean, + arg: SerializedArgument, +}; +export type ElementHandleEvalOnSelectorOptions = { + strict?: boolean, + isFunction?: boolean, +}; +export type ElementHandleEvalOnSelectorResult = { + value: SerializedValue, +}; +export type ElementHandleEvalOnSelectorAllParams = { + selector: string, + expression: string, + isFunction?: boolean, + arg: SerializedArgument, +}; +export type ElementHandleEvalOnSelectorAllOptions = { + isFunction?: boolean, +}; +export type ElementHandleEvalOnSelectorAllResult = { + value: SerializedValue, +}; +export type ElementHandleBoundingBoxParams = {}; +export type ElementHandleBoundingBoxOptions = {}; +export type ElementHandleBoundingBoxResult = { + value?: Rect, +}; +export type ElementHandleCheckParams = { + force?: boolean, + position?: Point, + timeout: number, + trial?: boolean, +}; +export type ElementHandleCheckOptions = { + force?: boolean, + position?: Point, + trial?: boolean, +}; +export type ElementHandleCheckResult = void; +export type ElementHandleClickParams = { + force?: boolean, + noWaitAfter?: boolean, + modifiers?: ('Alt' | 'Control' | 'ControlOrMeta' | 'Meta' | 'Shift')[], + position?: Point, + delay?: number, + button?: 'left' | 'right' | 'middle', + clickCount?: number, + timeout: number, + trial?: boolean, + steps?: number, +}; +export type ElementHandleClickOptions = { + force?: boolean, + noWaitAfter?: boolean, + modifiers?: ('Alt' | 'Control' | 'ControlOrMeta' | 'Meta' | 'Shift')[], + position?: Point, + delay?: number, + button?: 'left' | 'right' | 'middle', + clickCount?: number, + trial?: boolean, + steps?: number, +}; +export type ElementHandleClickResult = void; +export type ElementHandleContentFrameParams = {}; +export type ElementHandleContentFrameOptions = {}; +export type ElementHandleContentFrameResult = { + frame?: FrameChannel, +}; +export type ElementHandleDblclickParams = { + force?: boolean, + modifiers?: ('Alt' | 'Control' | 'ControlOrMeta' | 'Meta' | 'Shift')[], + position?: Point, + delay?: number, + button?: 'left' | 'right' | 'middle', + timeout: number, + trial?: boolean, + steps?: number, +}; +export type ElementHandleDblclickOptions = { + force?: boolean, + modifiers?: ('Alt' | 'Control' | 'ControlOrMeta' | 'Meta' | 'Shift')[], + position?: Point, + delay?: number, + button?: 'left' | 'right' | 'middle', + trial?: boolean, + steps?: number, +}; +export type ElementHandleDblclickResult = void; +export type ElementHandleDispatchEventParams = { + type: string, + eventInit: SerializedArgument, +}; +export type ElementHandleDispatchEventOptions = { + +}; +export type ElementHandleDispatchEventResult = void; +export type ElementHandleFillParams = { + value: string, + force?: boolean, + timeout: number, +}; +export type ElementHandleFillOptions = { + force?: boolean, +}; +export type ElementHandleFillResult = void; +export type ElementHandleFocusParams = {}; +export type ElementHandleFocusOptions = {}; +export type ElementHandleFocusResult = void; +export type ElementHandleGetAttributeParams = { + name: string, +}; +export type ElementHandleGetAttributeOptions = { + +}; +export type ElementHandleGetAttributeResult = { + value?: string, +}; +export type ElementHandleHoverParams = { + force?: boolean, + modifiers?: ('Alt' | 'Control' | 'ControlOrMeta' | 'Meta' | 'Shift')[], + position?: Point, + timeout: number, + trial?: boolean, +}; +export type ElementHandleHoverOptions = { + force?: boolean, + modifiers?: ('Alt' | 'Control' | 'ControlOrMeta' | 'Meta' | 'Shift')[], + position?: Point, + trial?: boolean, +}; +export type ElementHandleHoverResult = void; +export type ElementHandleInnerHTMLParams = {}; +export type ElementHandleInnerHTMLOptions = {}; +export type ElementHandleInnerHTMLResult = { + value: string, +}; +export type ElementHandleInnerTextParams = {}; +export type ElementHandleInnerTextOptions = {}; +export type ElementHandleInnerTextResult = { + value: string, +}; +export type ElementHandleInputValueParams = {}; +export type ElementHandleInputValueOptions = {}; +export type ElementHandleInputValueResult = { + value: string, +}; +export type ElementHandleIsCheckedParams = {}; +export type ElementHandleIsCheckedOptions = {}; +export type ElementHandleIsCheckedResult = { + value: boolean, +}; +export type ElementHandleIsDisabledParams = {}; +export type ElementHandleIsDisabledOptions = {}; +export type ElementHandleIsDisabledResult = { + value: boolean, +}; +export type ElementHandleIsEditableParams = {}; +export type ElementHandleIsEditableOptions = {}; +export type ElementHandleIsEditableResult = { + value: boolean, +}; +export type ElementHandleIsEnabledParams = {}; +export type ElementHandleIsEnabledOptions = {}; +export type ElementHandleIsEnabledResult = { + value: boolean, +}; +export type ElementHandleIsHiddenParams = {}; +export type ElementHandleIsHiddenOptions = {}; +export type ElementHandleIsHiddenResult = { + value: boolean, +}; +export type ElementHandleIsVisibleParams = {}; +export type ElementHandleIsVisibleOptions = {}; +export type ElementHandleIsVisibleResult = { + value: boolean, +}; +export type ElementHandleOwnerFrameParams = {}; +export type ElementHandleOwnerFrameOptions = {}; +export type ElementHandleOwnerFrameResult = { + frame?: FrameChannel, +}; +export type ElementHandlePressParams = { + key: string, + delay?: number, + timeout: number, + noWaitAfter?: boolean, +}; +export type ElementHandlePressOptions = { + delay?: number, + noWaitAfter?: boolean, +}; +export type ElementHandlePressResult = void; +export type ElementHandleQuerySelectorParams = { + selector: string, + strict?: boolean, +}; +export type ElementHandleQuerySelectorOptions = { + strict?: boolean, +}; +export type ElementHandleQuerySelectorResult = { + element?: ElementHandleChannel, +}; +export type ElementHandleQuerySelectorAllParams = { + selector: string, +}; +export type ElementHandleQuerySelectorAllOptions = { + +}; +export type ElementHandleQuerySelectorAllResult = { + elements: ElementHandleChannel[], +}; +export type ElementHandleScreenshotParams = { + timeout: number, + type?: 'png' | 'jpeg', + quality?: number, + omitBackground?: boolean, + caret?: 'hide' | 'initial', + animations?: 'disabled' | 'allow', + scale?: 'css' | 'device', + mask?: { + frame: FrameChannel, + selector: string, + }[], + maskColor?: string, + style?: string, +}; +export type ElementHandleScreenshotOptions = { + type?: 'png' | 'jpeg', + quality?: number, + omitBackground?: boolean, + caret?: 'hide' | 'initial', + animations?: 'disabled' | 'allow', + scale?: 'css' | 'device', + mask?: { + frame: FrameChannel, + selector: string, + }[], + maskColor?: string, + style?: string, +}; +export type ElementHandleScreenshotResult = { + binary: Binary, +}; +export type ElementHandleScrollIntoViewIfNeededParams = { + timeout: number, +}; +export type ElementHandleScrollIntoViewIfNeededOptions = { + +}; +export type ElementHandleScrollIntoViewIfNeededResult = void; +export type ElementHandleSelectOptionParams = { + elements?: ElementHandleChannel[], + options?: { + valueOrLabel?: string, + value?: string, + label?: string, + index?: number, + }[], + force?: boolean, + timeout: number, +}; +export type ElementHandleSelectOptionOptions = { + elements?: ElementHandleChannel[], + options?: { + valueOrLabel?: string, + value?: string, + label?: string, + index?: number, + }[], + force?: boolean, +}; +export type ElementHandleSelectOptionResult = { + values: string[], +}; +export type ElementHandleSelectTextParams = { + force?: boolean, + timeout: number, +}; +export type ElementHandleSelectTextOptions = { + force?: boolean, +}; +export type ElementHandleSelectTextResult = void; +export type ElementHandleSetInputFilesParams = { + payloads?: { + name: string, + mimeType?: string, + buffer: Binary, + }[], + localDirectory?: string, + directoryStream?: WritableStreamChannel, + localPaths?: string[], + streams?: WritableStreamChannel[], + timeout: number, +}; +export type ElementHandleSetInputFilesOptions = { + payloads?: { + name: string, + mimeType?: string, + buffer: Binary, + }[], + localDirectory?: string, + directoryStream?: WritableStreamChannel, + localPaths?: string[], + streams?: WritableStreamChannel[], +}; +export type ElementHandleSetInputFilesResult = void; +export type ElementHandleTapParams = { + force?: boolean, + modifiers?: ('Alt' | 'Control' | 'ControlOrMeta' | 'Meta' | 'Shift')[], + position?: Point, + timeout: number, + trial?: boolean, +}; +export type ElementHandleTapOptions = { + force?: boolean, + modifiers?: ('Alt' | 'Control' | 'ControlOrMeta' | 'Meta' | 'Shift')[], + position?: Point, + trial?: boolean, +}; +export type ElementHandleTapResult = void; +export type ElementHandleTextContentParams = {}; +export type ElementHandleTextContentOptions = {}; +export type ElementHandleTextContentResult = { + value?: string, +}; +export type ElementHandleTypeParams = { + text: string, + delay?: number, + timeout: number, +}; +export type ElementHandleTypeOptions = { + delay?: number, +}; +export type ElementHandleTypeResult = void; +export type ElementHandleUncheckParams = { + force?: boolean, + position?: Point, + timeout: number, + trial?: boolean, +}; +export type ElementHandleUncheckOptions = { + force?: boolean, + position?: Point, + trial?: boolean, +}; +export type ElementHandleUncheckResult = void; +export type ElementHandleWaitForElementStateParams = { + state: 'visible' | 'hidden' | 'stable' | 'enabled' | 'disabled' | 'editable', + timeout: number, +}; +export type ElementHandleWaitForElementStateOptions = { + +}; +export type ElementHandleWaitForElementStateResult = void; +export type ElementHandleWaitForSelectorParams = { + selector: string, + strict?: boolean, + timeout: number, + state?: 'attached' | 'detached' | 'visible' | 'hidden', +}; +export type ElementHandleWaitForSelectorOptions = { + strict?: boolean, + state?: 'attached' | 'detached' | 'visible' | 'hidden', +}; +export type ElementHandleWaitForSelectorResult = { + element?: ElementHandleChannel, +}; + +export interface ElementHandleEvents { +} + +// ----------- LocalUtils ----------- +export type LocalUtilsInitializer = { + deviceDescriptors: { + name: string, + descriptor: { + userAgent: string, + viewport: { + width: number, + height: number, + }, + screen?: { + width: number, + height: number, + }, + deviceScaleFactor: number, + isMobile: boolean, + hasTouch: boolean, + defaultBrowserType: 'chromium' | 'firefox' | 'webkit', + }, + }[], +}; +export interface LocalUtilsEventTarget { +} +export interface LocalUtilsChannel extends LocalUtilsEventTarget, Channel { + _type_LocalUtils: boolean; + zip(params: LocalUtilsZipParams, progress: Progress): Promise; + harOpen(params: LocalUtilsHarOpenParams, progress: Progress): Promise; + harLookup(params: LocalUtilsHarLookupParams, progress: Progress): Promise; + harClose(params: LocalUtilsHarCloseParams, progress: Progress): Promise; + harUnzip(params: LocalUtilsHarUnzipParams, progress: Progress): Promise; + connect(params: LocalUtilsConnectParams, progress: Progress): Promise; + tracingStarted(params: LocalUtilsTracingStartedParams, progress: Progress): Promise; + addStackToTracingNoReply(params: LocalUtilsAddStackToTracingNoReplyParams, progress: Progress): Promise; + traceDiscarded(params: LocalUtilsTraceDiscardedParams, progress: Progress): Promise; + globToRegex(params: LocalUtilsGlobToRegexParams, progress: Progress): Promise; +} +export type LocalUtilsZipParams = { + zipFile: string, + entries: NameValue[], + stacksId?: string, + mode: 'write' | 'append', + includeSources: boolean, + additionalSources?: string[], +}; +export type LocalUtilsZipOptions = { + stacksId?: string, + additionalSources?: string[], +}; +export type LocalUtilsZipResult = void; +export type LocalUtilsHarOpenParams = { + file: string, +}; +export type LocalUtilsHarOpenOptions = { + +}; +export type LocalUtilsHarOpenResult = { + harId?: string, + error?: string, +}; +export type LocalUtilsHarLookupParams = { + harId: string, + url: string, + method: string, + headers: NameValue[], + postData?: Binary, + isNavigationRequest: boolean, +}; +export type LocalUtilsHarLookupOptions = { + postData?: Binary, +}; +export type LocalUtilsHarLookupResult = { + action: 'error' | 'redirect' | 'fulfill' | 'noentry', + message?: string, + redirectURL?: string, + status?: number, + headers?: NameValue[], + body?: Binary, +}; +export type LocalUtilsHarCloseParams = { + harId: string, +}; +export type LocalUtilsHarCloseOptions = { + +}; +export type LocalUtilsHarCloseResult = void; +export type LocalUtilsHarUnzipParams = { + zipFile: string, + harFile: string, + resourcesDir?: string, +}; +export type LocalUtilsHarUnzipOptions = { + resourcesDir?: string, +}; +export type LocalUtilsHarUnzipResult = void; +export type LocalUtilsConnectParams = { + endpoint: string, + headers?: any, + exposeNetwork?: string, + slowMo?: number, + timeout: number, + socksProxyRedirectPortForTest?: number, +}; +export type LocalUtilsConnectOptions = { + headers?: any, + exposeNetwork?: string, + slowMo?: number, + socksProxyRedirectPortForTest?: number, +}; +export type LocalUtilsConnectResult = { + pipe: JsonPipeChannel, + headers: NameValue[], +}; +export type LocalUtilsTracingStartedParams = { + tracesDir?: string, + traceName: string, + live?: boolean, +}; +export type LocalUtilsTracingStartedOptions = { + tracesDir?: string, + live?: boolean, +}; +export type LocalUtilsTracingStartedResult = { + stacksId: string, +}; +export type LocalUtilsAddStackToTracingNoReplyParams = { + callData: ClientSideCallMetadata, +}; +export type LocalUtilsAddStackToTracingNoReplyOptions = { + +}; +export type LocalUtilsAddStackToTracingNoReplyResult = void; +export type LocalUtilsTraceDiscardedParams = { + stacksId: string, +}; +export type LocalUtilsTraceDiscardedOptions = { + +}; +export type LocalUtilsTraceDiscardedResult = void; +export type LocalUtilsGlobToRegexParams = { + glob: string, + baseURL?: string, + webSocketUrl?: boolean, +}; +export type LocalUtilsGlobToRegexOptions = { + baseURL?: string, + webSocketUrl?: boolean, +}; +export type LocalUtilsGlobToRegexResult = { + regex: string, +}; + +export interface LocalUtilsEvents { +} + +export type SetNetworkCookie = { + name: string, + value: string, + url?: string, + domain?: string, + path?: string, + expires?: number, + httpOnly?: boolean, + secure?: boolean, + sameSite?: 'Strict' | 'Lax' | 'None', + partitionKey?: string, + _crHasCrossSiteAncestor?: boolean, +}; + +export type NetworkCookie = { + name: string, + value: string, + domain: string, + path: string, + expires: number, + httpOnly: boolean, + secure: boolean, + sameSite: 'Strict' | 'Lax' | 'None', + partitionKey?: string, + _crHasCrossSiteAncestor?: boolean, +}; + +// ----------- Request ----------- +export type RequestInitializer = { + frame?: FrameChannel, + serviceWorker?: WorkerChannel, + url: string, + resourceType: string, + method: string, + postData?: Binary, + headers: NameValue[], + isNavigationRequest: boolean, + redirectedFrom?: RequestChannel, +}; +export interface RequestEventTarget { +} +export interface RequestChannel extends RequestEventTarget, Channel { + _type_Request: boolean; + response(params: RequestResponseParams, progress: Progress): Promise; + rawRequestHeaders(params: RequestRawRequestHeadersParams, progress: Progress): Promise; +} +export type RequestResponseParams = {}; +export type RequestResponseOptions = {}; +export type RequestResponseResult = { + response?: ResponseChannel, +}; +export type RequestRawRequestHeadersParams = {}; +export type RequestRawRequestHeadersOptions = {}; +export type RequestRawRequestHeadersResult = { + headers: NameValue[], +}; + +export interface RequestEvents { +} + +// ----------- Route ----------- +export type RouteInitializer = { + request: RequestChannel, +}; +export interface RouteEventTarget { +} +export interface RouteChannel extends RouteEventTarget, Channel { + _type_Route: boolean; + redirectNavigationRequest(params: RouteRedirectNavigationRequestParams, progress: Progress): Promise; + abort(params: RouteAbortParams, progress: Progress): Promise; + continue(params: RouteContinueParams, progress: Progress): Promise; + fulfill(params: RouteFulfillParams, progress: Progress): Promise; +} +export type RouteRedirectNavigationRequestParams = { + url: string, +}; +export type RouteRedirectNavigationRequestOptions = { + +}; +export type RouteRedirectNavigationRequestResult = void; +export type RouteAbortParams = { + errorCode?: string, +}; +export type RouteAbortOptions = { + errorCode?: string, +}; +export type RouteAbortResult = void; +export type RouteContinueParams = { + url?: string, + method?: string, + headers?: NameValue[], + postData?: Binary, + isFallback: boolean, +}; +export type RouteContinueOptions = { + url?: string, + method?: string, + headers?: NameValue[], + postData?: Binary, +}; +export type RouteContinueResult = void; +export type RouteFulfillParams = { + status?: number, + headers?: NameValue[], + body?: string, + isBase64?: boolean, + fetchResponseUid?: string, +}; +export type RouteFulfillOptions = { + status?: number, + headers?: NameValue[], + body?: string, + isBase64?: boolean, + fetchResponseUid?: string, +}; +export type RouteFulfillResult = void; + +export interface RouteEvents { +} + +// ----------- WebSocketRoute ----------- +export type WebSocketRouteInitializer = { + url: string, + protocols: string[], +}; +export interface WebSocketRouteEventTarget { + _dispatchEvent(event: 'messageFromPage', params?: WebSocketRouteMessageFromPageEvent): void; + _dispatchEvent(event: 'messageFromServer', params?: WebSocketRouteMessageFromServerEvent): void; + _dispatchEvent(event: 'closePage', params?: WebSocketRouteClosePageEvent): void; + _dispatchEvent(event: 'closeServer', params?: WebSocketRouteCloseServerEvent): void; +} +export interface WebSocketRouteChannel extends WebSocketRouteEventTarget, Channel { + _type_WebSocketRoute: boolean; + connect(params: WebSocketRouteConnectParams, progress: Progress): Promise; + ensureOpened(params: WebSocketRouteEnsureOpenedParams, progress: Progress): Promise; + sendToPage(params: WebSocketRouteSendToPageParams, progress: Progress): Promise; + sendToServer(params: WebSocketRouteSendToServerParams, progress: Progress): Promise; + closePage(params: WebSocketRouteClosePageParams, progress: Progress): Promise; + closeServer(params: WebSocketRouteCloseServerParams, progress: Progress): Promise; +} +export type WebSocketRouteMessageFromPageEvent = { + message: string, + isBase64: boolean, +}; +export type WebSocketRouteMessageFromServerEvent = { + message: string, + isBase64: boolean, +}; +export type WebSocketRouteClosePageEvent = { + code?: number, + reason?: string, + wasClean: boolean, +}; +export type WebSocketRouteCloseServerEvent = { + code?: number, + reason?: string, + wasClean: boolean, +}; +export type WebSocketRouteConnectParams = {}; +export type WebSocketRouteConnectOptions = {}; +export type WebSocketRouteConnectResult = void; +export type WebSocketRouteEnsureOpenedParams = {}; +export type WebSocketRouteEnsureOpenedOptions = {}; +export type WebSocketRouteEnsureOpenedResult = void; +export type WebSocketRouteSendToPageParams = { + message: string, + isBase64: boolean, +}; +export type WebSocketRouteSendToPageOptions = { + +}; +export type WebSocketRouteSendToPageResult = void; +export type WebSocketRouteSendToServerParams = { + message: string, + isBase64: boolean, +}; +export type WebSocketRouteSendToServerOptions = { + +}; +export type WebSocketRouteSendToServerResult = void; +export type WebSocketRouteClosePageParams = { + code?: number, + reason?: string, + wasClean: boolean, +}; +export type WebSocketRouteClosePageOptions = { + code?: number, + reason?: string, +}; +export type WebSocketRouteClosePageResult = void; +export type WebSocketRouteCloseServerParams = { + code?: number, + reason?: string, + wasClean: boolean, +}; +export type WebSocketRouteCloseServerOptions = { + code?: number, + reason?: string, +}; +export type WebSocketRouteCloseServerResult = void; + +export interface WebSocketRouteEvents { + 'messageFromPage': WebSocketRouteMessageFromPageEvent; + 'messageFromServer': WebSocketRouteMessageFromServerEvent; + 'closePage': WebSocketRouteClosePageEvent; + 'closeServer': WebSocketRouteCloseServerEvent; +} + +export type ResourceTiming = { + startTime: number, + domainLookupStart: number, + domainLookupEnd: number, + connectStart: number, + secureConnectionStart: number, + connectEnd: number, + requestStart: number, + responseStart: number, +}; + +// ----------- Response ----------- +export type ResponseInitializer = { + request: RequestChannel, + url: string, + status: number, + statusText: string, + headers: NameValue[], + timing: ResourceTiming, + fromServiceWorker: boolean, +}; +export interface ResponseEventTarget { +} +export interface ResponseChannel extends ResponseEventTarget, Channel { + _type_Response: boolean; + body(params: ResponseBodyParams, progress: Progress): Promise; + securityDetails(params: ResponseSecurityDetailsParams, progress: Progress): Promise; + serverAddr(params: ResponseServerAddrParams, progress: Progress): Promise; + rawResponseHeaders(params: ResponseRawResponseHeadersParams, progress: Progress): Promise; + httpVersion(params: ResponseHttpVersionParams, progress: Progress): Promise; + sizes(params: ResponseSizesParams, progress: Progress): Promise; +} +export type ResponseBodyParams = {}; +export type ResponseBodyOptions = {}; +export type ResponseBodyResult = { + binary: Binary, +}; +export type ResponseSecurityDetailsParams = {}; +export type ResponseSecurityDetailsOptions = {}; +export type ResponseSecurityDetailsResult = { + value?: SecurityDetails, +}; +export type ResponseServerAddrParams = {}; +export type ResponseServerAddrOptions = {}; +export type ResponseServerAddrResult = { + value?: RemoteAddr, +}; +export type ResponseRawResponseHeadersParams = {}; +export type ResponseRawResponseHeadersOptions = {}; +export type ResponseRawResponseHeadersResult = { + headers: NameValue[], +}; +export type ResponseHttpVersionParams = {}; +export type ResponseHttpVersionOptions = {}; +export type ResponseHttpVersionResult = { + value: string, +}; +export type ResponseSizesParams = {}; +export type ResponseSizesOptions = {}; +export type ResponseSizesResult = { + sizes: RequestSizes, +}; + +export interface ResponseEvents { +} + +export type SecurityDetails = { + issuer?: string, + protocol?: string, + subjectName?: string, + validFrom?: number, + validTo?: number, +}; + +export type RequestSizes = { + requestBodySize: number, + requestHeadersSize: number, + responseBodySize: number, + responseHeadersSize: number, +}; + +export type RemoteAddr = { + ipAddress: string, + port: number, +}; + +// ----------- WebSocket ----------- +export type WebSocketInitializer = { + url: string, +}; +export interface WebSocketEventTarget { + _dispatchEvent(event: 'open', params?: WebSocketOpenEvent): void; + _dispatchEvent(event: 'frameSent', params?: WebSocketFrameSentEvent): void; + _dispatchEvent(event: 'frameReceived', params?: WebSocketFrameReceivedEvent): void; + _dispatchEvent(event: 'socketError', params?: WebSocketSocketErrorEvent): void; + _dispatchEvent(event: 'close', params?: WebSocketCloseEvent): void; +} +export interface WebSocketChannel extends WebSocketEventTarget, Channel { + _type_WebSocket: boolean; +} +export type WebSocketOpenEvent = {}; +export type WebSocketFrameSentEvent = { + opcode: number, + data: string, +}; +export type WebSocketFrameReceivedEvent = { + opcode: number, + data: string, +}; +export type WebSocketSocketErrorEvent = { + error: string, +}; +export type WebSocketCloseEvent = {}; + +export interface WebSocketEvents { + 'open': WebSocketOpenEvent; + 'frameSent': WebSocketFrameSentEvent; + 'frameReceived': WebSocketFrameReceivedEvent; + 'socketError': WebSocketSocketErrorEvent; + 'close': WebSocketCloseEvent; +} + +// ----------- Page ----------- +export type PageInitializer = { + mainFrame: FrameChannel, + viewportSize?: { + width: number, + height: number, + }, + isClosed: boolean, + opener?: PageChannel, + video?: ArtifactChannel, +}; +export interface PageEventTarget { + _dispatchEvent(event: 'bindingCall', params?: PageBindingCallEvent): void; + _dispatchEvent(event: 'close', params?: PageCloseEvent): void; + _dispatchEvent(event: 'crash', params?: PageCrashEvent): void; + _dispatchEvent(event: 'download', params?: PageDownloadEvent): void; + _dispatchEvent(event: 'viewportSizeChanged', params?: PageViewportSizeChangedEvent): void; + _dispatchEvent(event: 'fileChooser', params?: PageFileChooserEvent): void; + _dispatchEvent(event: 'frameAttached', params?: PageFrameAttachedEvent): void; + _dispatchEvent(event: 'frameDetached', params?: PageFrameDetachedEvent): void; + _dispatchEvent(event: 'locatorHandlerTriggered', params?: PageLocatorHandlerTriggeredEvent): void; + _dispatchEvent(event: 'route', params?: PageRouteEvent): void; + _dispatchEvent(event: 'screencastFrame', params?: PageScreencastFrameEvent): void; + _dispatchEvent(event: 'webSocketRoute', params?: PageWebSocketRouteEvent): void; + _dispatchEvent(event: 'webSocket', params?: PageWebSocketEvent): void; + _dispatchEvent(event: 'worker', params?: PageWorkerEvent): void; +} +export interface PageChannel extends PageEventTarget, Channel { + _type_Page: boolean; + addInitScript(params: PageAddInitScriptParams, progress: Progress): Promise; + close(params: PageCloseParams, progress: Progress): Promise; + runBeforeUnload(params: PageRunBeforeUnloadParams, progress: Progress): Promise; + clearConsoleMessages(params: PageClearConsoleMessagesParams, progress: Progress): Promise; + consoleMessages(params: PageConsoleMessagesParams, progress: Progress): Promise; + emulateMedia(params: PageEmulateMediaParams, progress: Progress): Promise; + exposeBinding(params: PageExposeBindingParams, progress: Progress): Promise; + goBack(params: PageGoBackParams, progress: Progress): Promise; + goForward(params: PageGoForwardParams, progress: Progress): Promise; + requestGC(params: PageRequestGCParams, progress: Progress): Promise; + registerLocatorHandler(params: PageRegisterLocatorHandlerParams, progress: Progress): Promise; + resolveLocatorHandlerNoReply(params: PageResolveLocatorHandlerNoReplyParams, progress: Progress): Promise; + unregisterLocatorHandler(params: PageUnregisterLocatorHandlerParams, progress: Progress): Promise; + reload(params: PageReloadParams, progress: Progress): Promise; + expectScreenshot(params: PageExpectScreenshotParams, progress: Progress): Promise; + screenshot(params: PageScreenshotParams, progress: Progress): Promise; + setExtraHTTPHeaders(params: PageSetExtraHTTPHeadersParams, progress: Progress): Promise; + setNetworkInterceptionPatterns(params: PageSetNetworkInterceptionPatternsParams, progress: Progress): Promise; + setWebSocketInterceptionPatterns(params: PageSetWebSocketInterceptionPatternsParams, progress: Progress): Promise; + setViewportSize(params: PageSetViewportSizeParams, progress: Progress): Promise; + keyboardDown(params: PageKeyboardDownParams, progress: Progress): Promise; + keyboardUp(params: PageKeyboardUpParams, progress: Progress): Promise; + keyboardInsertText(params: PageKeyboardInsertTextParams, progress: Progress): Promise; + keyboardType(params: PageKeyboardTypeParams, progress: Progress): Promise; + keyboardPress(params: PageKeyboardPressParams, progress: Progress): Promise; + mouseMove(params: PageMouseMoveParams, progress: Progress): Promise; + mouseDown(params: PageMouseDownParams, progress: Progress): Promise; + mouseUp(params: PageMouseUpParams, progress: Progress): Promise; + mouseClick(params: PageMouseClickParams, progress: Progress): Promise; + mouseWheel(params: PageMouseWheelParams, progress: Progress): Promise; + touchscreenTap(params: PageTouchscreenTapParams, progress: Progress): Promise; + clearPageErrors(params: PageClearPageErrorsParams, progress: Progress): Promise; + pageErrors(params: PagePageErrorsParams, progress: Progress): Promise; + pdf(params: PagePdfParams, progress: Progress): Promise; + requests(params: PageRequestsParams, progress: Progress): Promise; + startJSCoverage(params: PageStartJSCoverageParams, progress: Progress): Promise; + stopJSCoverage(params: PageStopJSCoverageParams, progress: Progress): Promise; + startCSSCoverage(params: PageStartCSSCoverageParams, progress: Progress): Promise; + stopCSSCoverage(params: PageStopCSSCoverageParams, progress: Progress): Promise; + bringToFront(params: PageBringToFrontParams, progress: Progress): Promise; + pickLocator(params: PagePickLocatorParams, progress: Progress): Promise; + cancelPickLocator(params: PageCancelPickLocatorParams, progress: Progress): Promise; + hideHighlight(params: PageHideHighlightParams, progress: Progress): Promise; + screencastShowOverlay(params: PageScreencastShowOverlayParams, progress: Progress): Promise; + screencastRemoveOverlay(params: PageScreencastRemoveOverlayParams, progress: Progress): Promise; + screencastChapter(params: PageScreencastChapterParams, progress: Progress): Promise; + screencastSetOverlayVisible(params: PageScreencastSetOverlayVisibleParams, progress: Progress): Promise; + screencastShowActions(params: PageScreencastShowActionsParams, progress: Progress): Promise; + screencastHideActions(params: PageScreencastHideActionsParams, progress: Progress): Promise; + screencastStart(params: PageScreencastStartParams, progress: Progress): Promise; + screencastStop(params: PageScreencastStopParams, progress: Progress): Promise; + updateSubscription(params: PageUpdateSubscriptionParams, progress: Progress): Promise; + setDockTile(params: PageSetDockTileParams, progress: Progress): Promise; + webStorageItems(params: PageWebStorageItemsParams, progress: Progress): Promise; + webStorageGetItem(params: PageWebStorageGetItemParams, progress: Progress): Promise; + webStorageSetItem(params: PageWebStorageSetItemParams, progress: Progress): Promise; + webStorageRemoveItem(params: PageWebStorageRemoveItemParams, progress: Progress): Promise; + webStorageClear(params: PageWebStorageClearParams, progress: Progress): Promise; +} +export type PageBindingCallEvent = { + binding: BindingCallChannel, +}; +export type PageCloseEvent = {}; +export type PageCrashEvent = {}; +export type PageDownloadEvent = { + url: string, + suggestedFilename: string, + artifact: ArtifactChannel, +}; +export type PageViewportSizeChangedEvent = { + viewportSize?: { + width: number, + height: number, + }, +}; +export type PageFileChooserEvent = { + element: ElementHandleChannel, + isMultiple: boolean, +}; +export type PageFrameAttachedEvent = { + frame: FrameChannel, +}; +export type PageFrameDetachedEvent = { + frame: FrameChannel, +}; +export type PageLocatorHandlerTriggeredEvent = { + uid: number, +}; +export type PageRouteEvent = { + route: RouteChannel, +}; +export type PageScreencastFrameEvent = { + data: Binary, + timestamp: number, + viewportWidth: number, + viewportHeight: number, +}; +export type PageWebSocketRouteEvent = { + webSocketRoute: WebSocketRouteChannel, +}; +export type PageWebSocketEvent = { + webSocket: WebSocketChannel, +}; +export type PageWorkerEvent = { + worker: WorkerChannel, +}; +export type PageAddInitScriptParams = { + source: string, +}; +export type PageAddInitScriptOptions = { + +}; +export type PageAddInitScriptResult = { + disposable: DisposableChannel, +}; +export type PageCloseParams = { + reason?: string, +}; +export type PageCloseOptions = { + reason?: string, +}; +export type PageCloseResult = void; +export type PageRunBeforeUnloadParams = {}; +export type PageRunBeforeUnloadOptions = {}; +export type PageRunBeforeUnloadResult = void; +export type PageClearConsoleMessagesParams = {}; +export type PageClearConsoleMessagesOptions = {}; +export type PageClearConsoleMessagesResult = void; +export type PageConsoleMessagesParams = { + filter?: ConsoleMessagesFilter, +}; +export type PageConsoleMessagesOptions = { + filter?: ConsoleMessagesFilter, +}; +export type PageConsoleMessagesResult = { + messages: { + type: string, + text: string, + args: JSHandleChannel[], + location: { + url: string, + lineNumber: number, + columnNumber: number, + }, + timestamp: number, + }[], +}; +export type PageEmulateMediaParams = { + media?: 'screen' | 'print' | 'no-override', + colorScheme?: 'dark' | 'light' | 'no-preference' | 'no-override', + reducedMotion?: 'reduce' | 'no-preference' | 'no-override', + forcedColors?: 'active' | 'none' | 'no-override', + contrast?: 'no-preference' | 'more' | 'no-override', +}; +export type PageEmulateMediaOptions = { + media?: 'screen' | 'print' | 'no-override', + colorScheme?: 'dark' | 'light' | 'no-preference' | 'no-override', + reducedMotion?: 'reduce' | 'no-preference' | 'no-override', + forcedColors?: 'active' | 'none' | 'no-override', + contrast?: 'no-preference' | 'more' | 'no-override', +}; +export type PageEmulateMediaResult = void; +export type PageExposeBindingParams = { + name: string, +}; +export type PageExposeBindingOptions = { + +}; +export type PageExposeBindingResult = { + disposable: DisposableChannel, +}; +export type PageGoBackParams = { + timeout: number, + waitUntil?: LifecycleEvent, +}; +export type PageGoBackOptions = { + waitUntil?: LifecycleEvent, +}; +export type PageGoBackResult = { + response?: ResponseChannel, +}; +export type PageGoForwardParams = { + timeout: number, + waitUntil?: LifecycleEvent, +}; +export type PageGoForwardOptions = { + waitUntil?: LifecycleEvent, +}; +export type PageGoForwardResult = { + response?: ResponseChannel, +}; +export type PageRequestGCParams = {}; +export type PageRequestGCOptions = {}; +export type PageRequestGCResult = void; +export type PageRegisterLocatorHandlerParams = { + selector: string, + noWaitAfter?: boolean, +}; +export type PageRegisterLocatorHandlerOptions = { + noWaitAfter?: boolean, +}; +export type PageRegisterLocatorHandlerResult = { + uid: number, +}; +export type PageResolveLocatorHandlerNoReplyParams = { + uid: number, + remove?: boolean, +}; +export type PageResolveLocatorHandlerNoReplyOptions = { + remove?: boolean, +}; +export type PageResolveLocatorHandlerNoReplyResult = void; +export type PageUnregisterLocatorHandlerParams = { + uid: number, +}; +export type PageUnregisterLocatorHandlerOptions = { + +}; +export type PageUnregisterLocatorHandlerResult = void; +export type PageReloadParams = { + timeout: number, + waitUntil?: LifecycleEvent, +}; +export type PageReloadOptions = { + waitUntil?: LifecycleEvent, +}; +export type PageReloadResult = { + response?: ResponseChannel, +}; +export type PageExpectScreenshotParams = { + expected?: Binary, + timeout: number, + isNot: boolean, + locator?: { + frame: FrameChannel, + selector: string, + }, + comparator?: string, + maxDiffPixels?: number, + maxDiffPixelRatio?: number, + threshold?: number, + fullPage?: boolean, + clip?: Rect, + omitBackground?: boolean, + caret?: 'hide' | 'initial', + animations?: 'disabled' | 'allow', + scale?: 'css' | 'device', + mask?: { + frame: FrameChannel, + selector: string, + }[], + maskColor?: string, + style?: string, +}; +export type PageExpectScreenshotOptions = { + expected?: Binary, + locator?: { + frame: FrameChannel, + selector: string, + }, + comparator?: string, + maxDiffPixels?: number, + maxDiffPixelRatio?: number, + threshold?: number, + fullPage?: boolean, + clip?: Rect, + omitBackground?: boolean, + caret?: 'hide' | 'initial', + animations?: 'disabled' | 'allow', + scale?: 'css' | 'device', + mask?: { + frame: FrameChannel, + selector: string, + }[], + maskColor?: string, + style?: string, +}; +export type PageExpectScreenshotResult = { + actual?: Binary, +}; +export type PageExpectScreenshotErrorDetails = { + diff?: Binary, + customErrorMessage?: string, + actual?: Binary, + previous?: Binary, + timedOut?: boolean, + log?: string[], +}; +export type PageScreenshotParams = { + timeout: number, + type?: 'png' | 'jpeg', + quality?: number, + fullPage?: boolean, + clip?: Rect, + omitBackground?: boolean, + caret?: 'hide' | 'initial', + animations?: 'disabled' | 'allow', + scale?: 'css' | 'device', + mask?: { + frame: FrameChannel, + selector: string, + }[], + maskColor?: string, + style?: string, +}; +export type PageScreenshotOptions = { + type?: 'png' | 'jpeg', + quality?: number, + fullPage?: boolean, + clip?: Rect, + omitBackground?: boolean, + caret?: 'hide' | 'initial', + animations?: 'disabled' | 'allow', + scale?: 'css' | 'device', + mask?: { + frame: FrameChannel, + selector: string, + }[], + maskColor?: string, + style?: string, +}; +export type PageScreenshotResult = { + binary: Binary, +}; +export type PageSetExtraHTTPHeadersParams = { + headers: NameValue[], +}; +export type PageSetExtraHTTPHeadersOptions = { + +}; +export type PageSetExtraHTTPHeadersResult = void; +export type PageSetNetworkInterceptionPatternsParams = { + patterns: { + glob?: string, + regexSource?: string, + regexFlags?: string, + urlPattern?: URLPattern, + }[], +}; +export type PageSetNetworkInterceptionPatternsOptions = { + +}; +export type PageSetNetworkInterceptionPatternsResult = void; +export type PageSetWebSocketInterceptionPatternsParams = { + patterns: { + glob?: string, + regexSource?: string, + regexFlags?: string, + urlPattern?: URLPattern, + }[], +}; +export type PageSetWebSocketInterceptionPatternsOptions = { + +}; +export type PageSetWebSocketInterceptionPatternsResult = void; +export type PageSetViewportSizeParams = { + viewportSize: { + width: number, + height: number, + }, +}; +export type PageSetViewportSizeOptions = { + +}; +export type PageSetViewportSizeResult = void; +export type PageKeyboardDownParams = { + key: string, +}; +export type PageKeyboardDownOptions = { + +}; +export type PageKeyboardDownResult = void; +export type PageKeyboardUpParams = { + key: string, +}; +export type PageKeyboardUpOptions = { + +}; +export type PageKeyboardUpResult = void; +export type PageKeyboardInsertTextParams = { + text: string, +}; +export type PageKeyboardInsertTextOptions = { + +}; +export type PageKeyboardInsertTextResult = void; +export type PageKeyboardTypeParams = { + text: string, + delay?: number, +}; +export type PageKeyboardTypeOptions = { + delay?: number, +}; +export type PageKeyboardTypeResult = void; +export type PageKeyboardPressParams = { + key: string, + delay?: number, +}; +export type PageKeyboardPressOptions = { + delay?: number, +}; +export type PageKeyboardPressResult = void; +export type PageMouseMoveParams = { + x: number, + y: number, + steps?: number, +}; +export type PageMouseMoveOptions = { + steps?: number, +}; +export type PageMouseMoveResult = void; +export type PageMouseDownParams = { + button?: 'left' | 'right' | 'middle', + clickCount?: number, +}; +export type PageMouseDownOptions = { + button?: 'left' | 'right' | 'middle', + clickCount?: number, +}; +export type PageMouseDownResult = void; +export type PageMouseUpParams = { + button?: 'left' | 'right' | 'middle', + clickCount?: number, +}; +export type PageMouseUpOptions = { + button?: 'left' | 'right' | 'middle', + clickCount?: number, +}; +export type PageMouseUpResult = void; +export type PageMouseClickParams = { + x: number, + y: number, + delay?: number, + button?: 'left' | 'right' | 'middle', + clickCount?: number, +}; +export type PageMouseClickOptions = { + delay?: number, + button?: 'left' | 'right' | 'middle', + clickCount?: number, +}; +export type PageMouseClickResult = void; +export type PageMouseWheelParams = { + deltaX: number, + deltaY: number, +}; +export type PageMouseWheelOptions = { + +}; +export type PageMouseWheelResult = void; +export type PageTouchscreenTapParams = { + x: number, + y: number, +}; +export type PageTouchscreenTapOptions = { + +}; +export type PageTouchscreenTapResult = void; +export type PageClearPageErrorsParams = {}; +export type PageClearPageErrorsOptions = {}; +export type PageClearPageErrorsResult = void; +export type PagePageErrorsParams = { + filter?: ConsoleMessagesFilter, +}; +export type PagePageErrorsOptions = { + filter?: ConsoleMessagesFilter, +}; +export type PagePageErrorsResult = { + errors: SerializedError[], +}; +export type PagePdfParams = { + scale?: number, + displayHeaderFooter?: boolean, + headerTemplate?: string, + footerTemplate?: string, + printBackground?: boolean, + landscape?: boolean, + pageRanges?: string, + format?: string, + width?: string, + height?: string, + preferCSSPageSize?: boolean, + margin?: { + top?: string, + bottom?: string, + left?: string, + right?: string, + }, + tagged?: boolean, + outline?: boolean, +}; +export type PagePdfOptions = { + scale?: number, + displayHeaderFooter?: boolean, + headerTemplate?: string, + footerTemplate?: string, + printBackground?: boolean, + landscape?: boolean, + pageRanges?: string, + format?: string, + width?: string, + height?: string, + preferCSSPageSize?: boolean, + margin?: { + top?: string, + bottom?: string, + left?: string, + right?: string, + }, + tagged?: boolean, + outline?: boolean, +}; +export type PagePdfResult = { + pdf: Binary, +}; +export type PageRequestsParams = {}; +export type PageRequestsOptions = {}; +export type PageRequestsResult = { + requests: RequestChannel[], +}; +export type PageStartJSCoverageParams = { + resetOnNavigation?: boolean, + reportAnonymousScripts?: boolean, +}; +export type PageStartJSCoverageOptions = { + resetOnNavigation?: boolean, + reportAnonymousScripts?: boolean, +}; +export type PageStartJSCoverageResult = void; +export type PageStopJSCoverageParams = {}; +export type PageStopJSCoverageOptions = {}; +export type PageStopJSCoverageResult = { + entries: { + url: string, + scriptId: string, + source?: string, + functions: { + functionName: string, + isBlockCoverage: boolean, + ranges: { + startOffset: number, + endOffset: number, + count: number, + }[], + }[], + }[], +}; +export type PageStartCSSCoverageParams = { + resetOnNavigation?: boolean, +}; +export type PageStartCSSCoverageOptions = { + resetOnNavigation?: boolean, +}; +export type PageStartCSSCoverageResult = void; +export type PageStopCSSCoverageParams = {}; +export type PageStopCSSCoverageOptions = {}; +export type PageStopCSSCoverageResult = { + entries: { + url: string, + text?: string, + ranges: { + start: number, + end: number, + }[], + }[], +}; +export type PageBringToFrontParams = {}; +export type PageBringToFrontOptions = {}; +export type PageBringToFrontResult = void; +export type PagePickLocatorParams = {}; +export type PagePickLocatorOptions = {}; +export type PagePickLocatorResult = { + selector: string, +}; +export type PageCancelPickLocatorParams = {}; +export type PageCancelPickLocatorOptions = {}; +export type PageCancelPickLocatorResult = void; +export type PageHideHighlightParams = {}; +export type PageHideHighlightOptions = {}; +export type PageHideHighlightResult = void; +export type PageScreencastShowOverlayParams = { + html: string, + duration?: number, +}; +export type PageScreencastShowOverlayOptions = { + duration?: number, +}; +export type PageScreencastShowOverlayResult = { + id: string, +}; +export type PageScreencastRemoveOverlayParams = { + id: string, +}; +export type PageScreencastRemoveOverlayOptions = { + +}; +export type PageScreencastRemoveOverlayResult = void; +export type PageScreencastChapterParams = { + title: string, + description?: string, + duration?: number, +}; +export type PageScreencastChapterOptions = { + description?: string, + duration?: number, +}; +export type PageScreencastChapterResult = void; +export type PageScreencastSetOverlayVisibleParams = { + visible: boolean, +}; +export type PageScreencastSetOverlayVisibleOptions = { + +}; +export type PageScreencastSetOverlayVisibleResult = void; +export type PageScreencastShowActionsParams = { + duration?: number, + position?: 'top-left' | 'top' | 'top-right' | 'bottom-left' | 'bottom' | 'bottom-right', + fontSize?: number, + cursor?: 'none' | 'pointer', +}; +export type PageScreencastShowActionsOptions = { + duration?: number, + position?: 'top-left' | 'top' | 'top-right' | 'bottom-left' | 'bottom' | 'bottom-right', + fontSize?: number, + cursor?: 'none' | 'pointer', +}; +export type PageScreencastShowActionsResult = void; +export type PageScreencastHideActionsParams = {}; +export type PageScreencastHideActionsOptions = {}; +export type PageScreencastHideActionsResult = void; +export type PageScreencastStartParams = { + size?: { + width: number, + height: number, + }, + quality?: number, + sendFrames?: boolean, + record?: boolean, +}; +export type PageScreencastStartOptions = { + size?: { + width: number, + height: number, + }, + quality?: number, + sendFrames?: boolean, + record?: boolean, +}; +export type PageScreencastStartResult = { + artifact?: ArtifactChannel, +}; +export type PageScreencastStopParams = {}; +export type PageScreencastStopOptions = {}; +export type PageScreencastStopResult = void; +export type PageUpdateSubscriptionParams = { + event: 'console' | 'dialog' | 'fileChooser' | 'request' | 'response' | 'requestFinished' | 'requestFailed', + enabled: boolean, +}; +export type PageUpdateSubscriptionOptions = { + +}; +export type PageUpdateSubscriptionResult = void; +export type PageSetDockTileParams = { + image: Binary, +}; +export type PageSetDockTileOptions = { + +}; +export type PageSetDockTileResult = void; +export type PageWebStorageItemsParams = { + kind: 'local' | 'session', +}; +export type PageWebStorageItemsOptions = { + +}; +export type PageWebStorageItemsResult = { + items: NameValue[], +}; +export type PageWebStorageGetItemParams = { + kind: 'local' | 'session', + name: string, +}; +export type PageWebStorageGetItemOptions = { + +}; +export type PageWebStorageGetItemResult = { + value?: string, +}; +export type PageWebStorageSetItemParams = { + kind: 'local' | 'session', + name: string, + value: string, +}; +export type PageWebStorageSetItemOptions = { + +}; +export type PageWebStorageSetItemResult = void; +export type PageWebStorageRemoveItemParams = { + kind: 'local' | 'session', + name: string, +}; +export type PageWebStorageRemoveItemOptions = { + +}; +export type PageWebStorageRemoveItemResult = void; +export type PageWebStorageClearParams = { + kind: 'local' | 'session', +}; +export type PageWebStorageClearOptions = { + +}; +export type PageWebStorageClearResult = void; + +export interface PageEvents { + 'bindingCall': PageBindingCallEvent; + 'close': PageCloseEvent; + 'crash': PageCrashEvent; + 'download': PageDownloadEvent; + 'viewportSizeChanged': PageViewportSizeChangedEvent; + 'fileChooser': PageFileChooserEvent; + 'frameAttached': PageFrameAttachedEvent; + 'frameDetached': PageFrameDetachedEvent; + 'locatorHandlerTriggered': PageLocatorHandlerTriggeredEvent; + 'route': PageRouteEvent; + 'screencastFrame': PageScreencastFrameEvent; + 'webSocketRoute': PageWebSocketRouteEvent; + 'webSocket': PageWebSocketEvent; + 'worker': PageWorkerEvent; +} + +// ----------- Root ----------- +export type RootInitializer = {}; +export interface RootEventTarget { +} +export interface RootChannel extends RootEventTarget, Channel { + _type_Root: boolean; + initialize(params: RootInitializeParams, progress: Progress): Promise; +} +export type RootInitializeParams = { + sdkLanguage: SDKLanguage, +}; +export type RootInitializeOptions = { + +}; +export type RootInitializeResult = { + playwright: PlaywrightChannel, +}; + +export interface RootEvents { +} + +// ----------- Playwright ----------- +export type PlaywrightInitializer = { + chromium: BrowserTypeChannel, + firefox: BrowserTypeChannel, + webkit: BrowserTypeChannel, + android: AndroidChannel, + electron: ElectronChannel, + utils?: LocalUtilsChannel, + preLaunchedBrowser?: BrowserChannel, + preConnectedAndroidDevice?: AndroidDeviceChannel, + socksSupport?: SocksSupportChannel, +}; +export interface PlaywrightEventTarget { +} +export interface PlaywrightChannel extends PlaywrightEventTarget, Channel { + _type_Playwright: boolean; + newRequest(params: PlaywrightNewRequestParams, progress: Progress): Promise; +} +export type PlaywrightNewRequestParams = { + baseURL?: string, + userAgent?: string, + ignoreHTTPSErrors?: boolean, + extraHTTPHeaders?: NameValue[], + failOnStatusCode?: boolean, + clientCertificates?: { + origin: string, + cert?: Binary, + key?: Binary, + passphrase?: string, + pfx?: Binary, + }[], + maxRedirects?: number, + httpCredentials?: { + username: string, + password: string, + origin?: string, + send?: 'always' | 'unauthorized', + }, + proxy?: { + server: string, + bypass?: string, + username?: string, + password?: string, + }, + storageState?: { + cookies?: NetworkCookie[], + origins?: SetOriginStorage[], + }, + tracesDir?: string, +}; +export type PlaywrightNewRequestOptions = { + baseURL?: string, + userAgent?: string, + ignoreHTTPSErrors?: boolean, + extraHTTPHeaders?: NameValue[], + failOnStatusCode?: boolean, + clientCertificates?: { + origin: string, + cert?: Binary, + key?: Binary, + passphrase?: string, + pfx?: Binary, + }[], + maxRedirects?: number, + httpCredentials?: { + username: string, + password: string, + origin?: string, + send?: 'always' | 'unauthorized', + }, + proxy?: { + server: string, + bypass?: string, + username?: string, + password?: string, + }, + storageState?: { + cookies?: NetworkCookie[], + origins?: SetOriginStorage[], + }, + tracesDir?: string, +}; +export type PlaywrightNewRequestResult = { + request: APIRequestContextChannel, +}; + +export interface PlaywrightEvents { +} + +// ----------- DebugController ----------- +export type DebugControllerInitializer = {}; +export interface DebugControllerEventTarget { + _dispatchEvent(event: 'inspectRequested', params?: DebugControllerInspectRequestedEvent): void; + _dispatchEvent(event: 'setModeRequested', params?: DebugControllerSetModeRequestedEvent): void; + _dispatchEvent(event: 'stateChanged', params?: DebugControllerStateChangedEvent): void; + _dispatchEvent(event: 'sourceChanged', params?: DebugControllerSourceChangedEvent): void; + _dispatchEvent(event: 'paused', params?: DebugControllerPausedEvent): void; +} +export interface DebugControllerChannel extends DebugControllerEventTarget, Channel { + _type_DebugController: boolean; + initialize(params: DebugControllerInitializeParams, progress: Progress): Promise; + setReportStateChanged(params: DebugControllerSetReportStateChangedParams, progress: Progress): Promise; + setRecorderMode(params: DebugControllerSetRecorderModeParams, progress: Progress): Promise; + highlight(params: DebugControllerHighlightParams, progress: Progress): Promise; + hideHighlight(params: DebugControllerHideHighlightParams, progress: Progress): Promise; + resume(params: DebugControllerResumeParams, progress: Progress): Promise; + kill(params: DebugControllerKillParams, progress: Progress): Promise; +} +export type DebugControllerInspectRequestedEvent = { + selector: string, + locator: string, + ariaSnapshot: string, +}; +export type DebugControllerSetModeRequestedEvent = { + mode: string, +}; +export type DebugControllerStateChangedEvent = { + pageCount: number, +}; +export type DebugControllerSourceChangedEvent = { + text: string, + header?: string, + footer?: string, + actions?: string[], +}; +export type DebugControllerPausedEvent = { + paused: boolean, +}; +export type DebugControllerInitializeParams = { + codegenId: string, + sdkLanguage: SDKLanguage, +}; +export type DebugControllerInitializeOptions = { + +}; +export type DebugControllerInitializeResult = void; +export type DebugControllerSetReportStateChangedParams = { + enabled: boolean, +}; +export type DebugControllerSetReportStateChangedOptions = { + +}; +export type DebugControllerSetReportStateChangedResult = void; +export type DebugControllerSetRecorderModeParams = { + mode: 'inspecting' | 'recording' | 'none', + testIdAttributeName?: string, + generateAutoExpect?: boolean, +}; +export type DebugControllerSetRecorderModeOptions = { + testIdAttributeName?: string, + generateAutoExpect?: boolean, +}; +export type DebugControllerSetRecorderModeResult = void; +export type DebugControllerHighlightParams = { + selector?: string, + ariaTemplate?: string, +}; +export type DebugControllerHighlightOptions = { + selector?: string, + ariaTemplate?: string, +}; +export type DebugControllerHighlightResult = void; +export type DebugControllerHideHighlightParams = {}; +export type DebugControllerHideHighlightOptions = {}; +export type DebugControllerHideHighlightResult = void; +export type DebugControllerResumeParams = {}; +export type DebugControllerResumeOptions = {}; +export type DebugControllerResumeResult = void; +export type DebugControllerKillParams = {}; +export type DebugControllerKillOptions = {}; +export type DebugControllerKillResult = void; + +export interface DebugControllerEvents { + 'inspectRequested': DebugControllerInspectRequestedEvent; + 'setModeRequested': DebugControllerSetModeRequestedEvent; + 'stateChanged': DebugControllerStateChangedEvent; + 'sourceChanged': DebugControllerSourceChangedEvent; + 'paused': DebugControllerPausedEvent; +} + +// ----------- SocksSupport ----------- +export type SocksSupportInitializer = {}; +export interface SocksSupportEventTarget { + _dispatchEvent(event: 'socksRequested', params?: SocksSupportSocksRequestedEvent): void; + _dispatchEvent(event: 'socksData', params?: SocksSupportSocksDataEvent): void; + _dispatchEvent(event: 'socksClosed', params?: SocksSupportSocksClosedEvent): void; +} +export interface SocksSupportChannel extends SocksSupportEventTarget, Channel { + _type_SocksSupport: boolean; + socksConnected(params: SocksSupportSocksConnectedParams, progress: Progress): Promise; + socksFailed(params: SocksSupportSocksFailedParams, progress: Progress): Promise; + socksData(params: SocksSupportSocksDataParams, progress: Progress): Promise; + socksError(params: SocksSupportSocksErrorParams, progress: Progress): Promise; + socksEnd(params: SocksSupportSocksEndParams, progress: Progress): Promise; +} +export type SocksSupportSocksRequestedEvent = { + uid: string, + host: string, + port: number, +}; +export type SocksSupportSocksDataEvent = { + uid: string, + data: Binary, +}; +export type SocksSupportSocksClosedEvent = { + uid: string, +}; +export type SocksSupportSocksConnectedParams = { + uid: string, + host: string, + port: number, +}; +export type SocksSupportSocksConnectedOptions = { + +}; +export type SocksSupportSocksConnectedResult = void; +export type SocksSupportSocksFailedParams = { + uid: string, + errorCode: string, +}; +export type SocksSupportSocksFailedOptions = { + +}; +export type SocksSupportSocksFailedResult = void; +export type SocksSupportSocksDataParams = { + uid: string, + data: Binary, +}; +export type SocksSupportSocksDataOptions = { + +}; +export type SocksSupportSocksDataResult = void; +export type SocksSupportSocksErrorParams = { + uid: string, + error: string, +}; +export type SocksSupportSocksErrorOptions = { + +}; +export type SocksSupportSocksErrorResult = void; +export type SocksSupportSocksEndParams = { + uid: string, +}; +export type SocksSupportSocksEndOptions = { + +}; +export type SocksSupportSocksEndResult = void; + +export interface SocksSupportEvents { + 'socksRequested': SocksSupportSocksRequestedEvent; + 'socksData': SocksSupportSocksDataEvent; + 'socksClosed': SocksSupportSocksClosedEvent; +} + +// ----------- JsonPipe ----------- +export type JsonPipeInitializer = {}; +export interface JsonPipeEventTarget { + _dispatchEvent(event: 'message', params?: JsonPipeMessageEvent): void; + _dispatchEvent(event: 'closed', params?: JsonPipeClosedEvent): void; +} +export interface JsonPipeChannel extends JsonPipeEventTarget, Channel { + _type_JsonPipe: boolean; + send(params: JsonPipeSendParams, progress: Progress): Promise; + close(params: JsonPipeCloseParams, progress: Progress): Promise; +} +export type JsonPipeMessageEvent = { + message: any, +}; +export type JsonPipeClosedEvent = { + reason?: string, +}; +export type JsonPipeSendParams = { + message: any, +}; +export type JsonPipeSendOptions = { + +}; +export type JsonPipeSendResult = void; +export type JsonPipeCloseParams = {}; +export type JsonPipeCloseOptions = {}; +export type JsonPipeCloseResult = void; + +export interface JsonPipeEvents { + 'message': JsonPipeMessageEvent; + 'closed': JsonPipeClosedEvent; +} + +export type ExpectedTextValue = { + string?: string, + regexSource?: string, + regexFlags?: string, + matchSubstring?: boolean, + ignoreCase?: boolean, + normalizeWhiteSpace?: boolean, +}; + +export type SelectorEngine = { + name: string, + source: string, + contentScript?: boolean, +}; + +export type FormField = { + name: string, + value?: string, + file?: { + name: string, + mimeType?: string, + buffer: Binary, + }, +}; + +export type LifecycleEvent = 'load' | 'domcontentloaded' | 'networkidle' | 'commit'; +export type ConsoleMessagesFilter = 'all' | 'since-navigation'; +export type RecorderSource = { + isRecorded: boolean, + id: string, + label: string, + text: string, + language: string, + highlight: { + line: number, + type: string, + }[], + revealLine?: number, + group?: string, +}; + +export type IndexedDBDatabase = { + name: string, + version: number, + stores: { + name: string, + autoIncrement: boolean, + keyPath?: string, + keyPathArray?: string[], + records: { + key?: any, + keyEncoded?: any, + value?: any, + valueEncoded?: any, + }[], + indexes: { + name: string, + keyPath?: string, + keyPathArray?: string[], + multiEntry: boolean, + unique: boolean, + }[], + }[], +}; + +export type SetOriginStorage = { + origin: string, + localStorage: NameValue[], + indexedDB?: IndexedDBDatabase[], +}; + +export type OriginStorage = { + origin: string, + localStorage: NameValue[], + indexedDB?: IndexedDBDatabase[], +}; + +export type RecordHarOptions = { + content?: 'embed' | 'attach' | 'omit', + mode?: 'full' | 'minimal', + urlGlob?: string, + urlRegexSource?: string, + urlRegexFlags?: string, + harPath?: string, + resourcesDir?: string, +}; + +// ----------- CDPSession ----------- +export type CDPSessionInitializer = {}; +export interface CDPSessionEventTarget { + _dispatchEvent(event: 'event', params?: CDPSessionEventEvent): void; + _dispatchEvent(event: 'close', params?: CDPSessionCloseEvent): void; +} +export interface CDPSessionChannel extends CDPSessionEventTarget, Channel { + _type_CDPSession: boolean; + send(params: CDPSessionSendParams, progress: Progress): Promise; + detach(params: CDPSessionDetachParams, progress: Progress): Promise; +} +export type CDPSessionEventEvent = { + method: string, + params?: any, +}; +export type CDPSessionCloseEvent = {}; +export type CDPSessionSendParams = { + method: string, + params?: any, +}; +export type CDPSessionSendOptions = { + params?: any, +}; +export type CDPSessionSendResult = { + result: any, +}; +export type CDPSessionDetachParams = {}; +export type CDPSessionDetachOptions = {}; +export type CDPSessionDetachResult = void; + +export interface CDPSessionEvents { + 'event': CDPSessionEventEvent; + 'close': CDPSessionCloseEvent; +} + +// ----------- BindingCall ----------- +export type BindingCallInitializer = { + frame: FrameChannel, + name: string, + args: SerializedValue[], +}; +export interface BindingCallEventTarget { +} +export interface BindingCallChannel extends BindingCallEventTarget, Channel { + _type_BindingCall: boolean; + reject(params: BindingCallRejectParams, progress: Progress): Promise; + resolve(params: BindingCallResolveParams, progress: Progress): Promise; +} +export type BindingCallRejectParams = { + error: SerializedError, +}; +export type BindingCallRejectOptions = { + +}; +export type BindingCallRejectResult = void; +export type BindingCallResolveParams = { + result: SerializedArgument, +}; +export type BindingCallResolveOptions = { + +}; +export type BindingCallResolveResult = void; + +export interface BindingCallEvents { +} + +// ----------- Debugger ----------- +export type DebuggerInitializer = {}; +export interface DebuggerEventTarget { + _dispatchEvent(event: 'pausedStateChanged', params?: DebuggerPausedStateChangedEvent): void; +} +export interface DebuggerChannel extends DebuggerEventTarget, Channel { + _type_Debugger: boolean; + requestPause(params: DebuggerRequestPauseParams, progress: Progress): Promise; + resume(params: DebuggerResumeParams, progress: Progress): Promise; + next(params: DebuggerNextParams, progress: Progress): Promise; + runTo(params: DebuggerRunToParams, progress: Progress): Promise; +} +export type DebuggerPausedStateChangedEvent = { + pausedDetails?: { + location: { + file: string, + line?: number, + column?: number, + }, + title: string, + stack?: string, + }, +}; +export type DebuggerRequestPauseParams = {}; +export type DebuggerRequestPauseOptions = {}; +export type DebuggerRequestPauseResult = void; +export type DebuggerResumeParams = {}; +export type DebuggerResumeOptions = {}; +export type DebuggerResumeResult = void; +export type DebuggerNextParams = {}; +export type DebuggerNextOptions = {}; +export type DebuggerNextResult = void; +export type DebuggerRunToParams = { + location: { + file: string, + line?: number, + column?: number, + }, +}; +export type DebuggerRunToOptions = { + +}; +export type DebuggerRunToResult = void; + +export interface DebuggerEvents { + 'pausedStateChanged': DebuggerPausedStateChangedEvent; +} + +// ----------- Dialog ----------- +export type DialogInitializer = { + page?: PageChannel, + type: string, + message: string, + defaultValue: string, +}; +export interface DialogEventTarget { +} +export interface DialogChannel extends DialogEventTarget, Channel { + _type_Dialog: boolean; + accept(params: DialogAcceptParams, progress: Progress): Promise; + dismiss(params: DialogDismissParams, progress: Progress): Promise; +} +export type DialogAcceptParams = { + promptText?: string, +}; +export type DialogAcceptOptions = { + promptText?: string, +}; +export type DialogAcceptResult = void; +export type DialogDismissParams = {}; +export type DialogDismissOptions = {}; +export type DialogDismissResult = void; + +export interface DialogEvents { +} + +export type SerializedValue = { + n?: number, + b?: boolean, + s?: string, + v?: 'null' | 'undefined' | 'NaN' | 'Infinity' | '-Infinity' | '-0', + d?: string, + u?: string, + bi?: string, + ta?: { + b: Binary, + k: 'i8' | 'ui8' | 'ui8c' | 'i16' | 'ui16' | 'i32' | 'ui32' | 'f32' | 'f64' | 'bi64' | 'bui64', + }, + e?: { + m: string, + n: string, + s: string, + }, + r?: { + p: string, + f: string, + }, + a?: SerializedValue[], + o?: { + k: string, + v: SerializedValue, + }[], + h?: number, + id?: number, + ref?: number, +}; + +export type SerializedArgument = { + value: SerializedValue, + handles: Channel[], +}; + +export type SerializedError = { + error?: { + message: string, + name: string, + stack?: string, + }, + value?: SerializedValue, +}; + +export type StackFrame = { + file: string, + line: number, + column: number, + function?: string, +}; + +export type VirtualCredential = { + id: string, + rpId: string, + userHandle: string, + privateKey: string, + publicKey: string, +}; + +export type Point = { + x: number, + y: number, +}; + +export type Rect = { + x: number, + y: number, + width: number, + height: number, +}; + +export type URLPattern = { + hash: string, + hostname: string, + password: string, + pathname: string, + port: string, + protocol: string, + search: string, + username: string, +}; + +export type NameValue = { + name: string, + value: string, +}; + +// ----------- Tracing ----------- +export type TracingInitializer = {}; +export interface TracingEventTarget { +} +export interface TracingChannel extends TracingEventTarget, Channel { + _type_Tracing: boolean; + tracingStart(params: TracingTracingStartParams, progress: Progress): Promise; + tracingStartChunk(params: TracingTracingStartChunkParams, progress: Progress): Promise; + tracingGroup(params: TracingTracingGroupParams, progress: Progress): Promise; + tracingGroupEnd(params: TracingTracingGroupEndParams, progress: Progress): Promise; + tracingStopChunk(params: TracingTracingStopChunkParams, progress: Progress): Promise; + tracingStop(params: TracingTracingStopParams, progress: Progress): Promise; + harStart(params: TracingHarStartParams, progress: Progress): Promise; + harExport(params: TracingHarExportParams, progress: Progress): Promise; +} +export type TracingTracingStartParams = { + name?: string, + snapshots?: boolean, + screenshots?: boolean, + live?: boolean, +}; +export type TracingTracingStartOptions = { + name?: string, + snapshots?: boolean, + screenshots?: boolean, + live?: boolean, +}; +export type TracingTracingStartResult = void; +export type TracingTracingStartChunkParams = { + name?: string, + title?: string, +}; +export type TracingTracingStartChunkOptions = { + name?: string, + title?: string, +}; +export type TracingTracingStartChunkResult = { + traceName: string, +}; +export type TracingTracingGroupParams = { + name: string, + location?: { + file: string, + line?: number, + column?: number, + }, +}; +export type TracingTracingGroupOptions = { + location?: { + file: string, + line?: number, + column?: number, + }, +}; +export type TracingTracingGroupResult = void; +export type TracingTracingGroupEndParams = {}; +export type TracingTracingGroupEndOptions = {}; +export type TracingTracingGroupEndResult = void; +export type TracingTracingStopChunkParams = { + mode: 'archive' | 'discard' | 'entries', +}; +export type TracingTracingStopChunkOptions = { + +}; +export type TracingTracingStopChunkResult = { + artifact?: ArtifactChannel, + entries?: NameValue[], +}; +export type TracingTracingStopParams = {}; +export type TracingTracingStopOptions = {}; +export type TracingTracingStopResult = void; +export type TracingHarStartParams = { + page?: PageChannel, + options: RecordHarOptions, +}; +export type TracingHarStartOptions = { + page?: PageChannel, +}; +export type TracingHarStartResult = { + harId: string, +}; +export type TracingHarExportParams = { + harId?: string, + mode: 'archive' | 'entries', +}; +export type TracingHarExportOptions = { + harId?: string, +}; +export type TracingHarExportResult = { + artifact?: ArtifactChannel, + entries?: NameValue[], +}; + +export interface TracingEvents { +} + +// ----------- Worker ----------- +export type WorkerInitializer = { + url: string, +}; +export interface WorkerEventTarget { + _dispatchEvent(event: 'console', params?: WorkerConsoleEvent): void; + _dispatchEvent(event: 'close', params?: WorkerCloseEvent): void; +} +export interface WorkerChannel extends WorkerEventTarget, Channel { + _type_Worker: boolean; + disconnect(params: WorkerDisconnectParams, progress: Progress): Promise; + evaluateExpression(params: WorkerEvaluateExpressionParams, progress: Progress): Promise; + evaluateExpressionHandle(params: WorkerEvaluateExpressionHandleParams, progress: Progress): Promise; + updateSubscription(params: WorkerUpdateSubscriptionParams, progress: Progress): Promise; +} +export type WorkerConsoleEvent = { + type: string, + text: string, + args: JSHandleChannel[], + location: { + url: string, + lineNumber: number, + columnNumber: number, + }, + timestamp: number, +}; +export type WorkerCloseEvent = {}; +export type WorkerDisconnectParams = { + reason?: string, +}; +export type WorkerDisconnectOptions = { + reason?: string, +}; +export type WorkerDisconnectResult = void; +export type WorkerEvaluateExpressionParams = { + expression: string, + isFunction?: boolean, + arg: SerializedArgument, +}; +export type WorkerEvaluateExpressionOptions = { + isFunction?: boolean, +}; +export type WorkerEvaluateExpressionResult = { + value: SerializedValue, +}; +export type WorkerEvaluateExpressionHandleParams = { + expression: string, + isFunction?: boolean, + arg: SerializedArgument, +}; +export type WorkerEvaluateExpressionHandleOptions = { + isFunction?: boolean, +}; +export type WorkerEvaluateExpressionHandleResult = { + handle: JSHandleChannel, +}; +export type WorkerUpdateSubscriptionParams = { + event: 'console', + enabled: boolean, +}; +export type WorkerUpdateSubscriptionOptions = { + +}; +export type WorkerUpdateSubscriptionResult = void; + +export interface WorkerEvents { + 'console': WorkerConsoleEvent; + 'close': WorkerCloseEvent; +} + diff --git a/packages/playwright-core/src/server/chromium/chromium.ts b/packages/playwright-core/src/server/chromium/chromium.ts index d9f1c9da72602..68d0a9096e21b 100644 --- a/packages/playwright-core/src/server/chromium/chromium.ts +++ b/packages/playwright-core/src/server/chromium/chromium.ts @@ -51,7 +51,7 @@ import type { Progress } from '../progress'; import type { ConnectionTransport, ProtocolRequest } from '../transport'; import type { BrowserContext } from '../browserContext'; import type * as types from '../types'; -import type * as channels from '@protocol/channels'; +import type * as channels from '../channels'; import type http from 'http'; import type stream from 'stream'; diff --git a/packages/playwright-core/src/server/chromium/crBrowser.ts b/packages/playwright-core/src/server/chromium/crBrowser.ts index 27a3409fb5c28..e4d95a68432d2 100644 --- a/packages/playwright-core/src/server/chromium/crBrowser.ts +++ b/packages/playwright-core/src/server/chromium/crBrowser.ts @@ -38,7 +38,7 @@ import type { CRDevTools } from './crDevTools'; import type { Protocol } from './protocol'; import type { BrowserOptions } from '../browser'; import type { SdkObject } from '../instrumentation'; -import type * as channels from '@protocol/channels'; +import type * as channels from '../channels'; export class CRBrowser extends Browser { readonly _connection: CRConnection; diff --git a/packages/playwright-core/src/server/chromium/crConnection.ts b/packages/playwright-core/src/server/chromium/crConnection.ts index 54a776c5639cf..1669359ae3a41 100644 --- a/packages/playwright-core/src/server/chromium/crConnection.ts +++ b/packages/playwright-core/src/server/chromium/crConnection.ts @@ -27,7 +27,7 @@ import type { ConnectionTransport, ProtocolRequest, ProtocolResponse } from '../ import type { Protocol } from './protocol'; import type { RecentLogsCollector } from '@utils/debugLogger'; import type { ProtocolLogger } from '../types'; -import type { Progress } from '@protocol/progress'; +import type { Progress } from '../progress'; export const ConnectionEvents = { diff --git a/packages/playwright-core/src/server/chromium/crCoverage.ts b/packages/playwright-core/src/server/chromium/crCoverage.ts index 43f73ce1b39cf..adbc7622dac94 100644 --- a/packages/playwright-core/src/server/chromium/crCoverage.ts +++ b/packages/playwright-core/src/server/chromium/crCoverage.ts @@ -22,8 +22,8 @@ import { raceUncancellableOperationWithCleanup } from '../progress'; import type { CRSession } from './crConnection'; import type { Protocol } from './protocol'; import type { RegisteredListener } from '@utils/eventsHelper'; -import type * as channels from '@protocol/channels'; -import type { Progress } from '@protocol/progress'; +import type * as channels from '../channels'; +import type { Progress } from '../progress'; export class CRCoverage { diff --git a/packages/playwright-core/src/server/chromium/crPage.ts b/packages/playwright-core/src/server/chromium/crPage.ts index cbb1d4eb13b8d..82139d2facac7 100644 --- a/packages/playwright-core/src/server/chromium/crPage.ts +++ b/packages/playwright-core/src/server/chromium/crPage.ts @@ -44,7 +44,7 @@ import type { RegisteredListener } from '@utils/eventsHelper'; import type { InitScript, PageDelegate } from '../page'; import type { Progress } from '../progress'; import type * as types from '../types'; -import type * as channels from '@protocol/channels'; +import type * as channels from '../channels'; export type WindowBounds = { top?: number, left?: number, width?: number, height?: number }; diff --git a/packages/playwright-core/src/server/chromium/crPdf.ts b/packages/playwright-core/src/server/chromium/crPdf.ts index 91be70fc73194..b9a6fe3a243e5 100644 --- a/packages/playwright-core/src/server/chromium/crPdf.ts +++ b/packages/playwright-core/src/server/chromium/crPdf.ts @@ -19,7 +19,7 @@ import { assert } from '@isomorphic/assert'; import { readProtocolStream } from './crProtocolHelper'; import type { CRSession } from './crConnection'; -import type * as channels from '@protocol/channels'; +import type * as channels from '../channels'; const PagePaperFormats: { [key: string]: { width: number, height: number }} = { letter: { width: 8.5, height: 11 }, diff --git a/packages/playwright-core/src/server/clock.ts b/packages/playwright-core/src/server/clock.ts index b14fbb4cdd1e8..d4601596e7ec5 100644 --- a/packages/playwright-core/src/server/clock.ts +++ b/packages/playwright-core/src/server/clock.ts @@ -19,7 +19,7 @@ import { nullProgress } from './progress'; import type { BrowserContext } from './browserContext'; import type { InitScript } from './page'; -import type { Progress } from '@protocol/progress'; +import type { Progress } from './progress'; export class Clock { private _browserContext: BrowserContext; diff --git a/packages/playwright-core/src/server/cookieStore.ts b/packages/playwright-core/src/server/cookieStore.ts index 3337dbe90df41..2e5fdd8fba1ad 100644 --- a/packages/playwright-core/src/server/cookieStore.ts +++ b/packages/playwright-core/src/server/cookieStore.ts @@ -16,7 +16,7 @@ import { isLocalHostname, kMaxCookieExpiresDateInSeconds } from './network'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; export class Cookie { private _raw: channels.NetworkCookie; diff --git a/packages/playwright-core/src/server/credentials.ts b/packages/playwright-core/src/server/credentials.ts index 1f70392e588cd..5424f9bf067e8 100644 --- a/packages/playwright-core/src/server/credentials.ts +++ b/packages/playwright-core/src/server/credentials.ts @@ -21,7 +21,7 @@ import { nullProgress } from './progress'; import type { BrowserContext } from './browserContext'; import type { InitScript } from './page'; -import type { Progress } from '@protocol/progress'; +import type { Progress } from './progress'; const kBindingName = '__pwWebAuthnBinding'; const kAuthenticatorAAGUID = Buffer.alloc(16); // All-zero AAGUID for the virtual authenticator. diff --git a/packages/playwright-core/src/server/debugController.ts b/packages/playwright-core/src/server/debugController.ts index 899d9b15d8c04..a733dd2379cbd 100644 --- a/packages/playwright-core/src/server/debugController.ts +++ b/packages/playwright-core/src/server/debugController.ts @@ -30,7 +30,7 @@ import type { BrowserContext } from './browserContext'; import type { InstrumentationListener } from './instrumentation'; import type { Playwright } from './playwright'; import type { ElementInfo, Mode } from '@recorder/recorderTypes'; -import type { Progress } from '@protocol/progress'; +import type { Progress } from './progress'; import type * as actions from '@recorder/actions'; export class DebugController extends SdkObject { diff --git a/packages/playwright-core/src/server/debugger.ts b/packages/playwright-core/src/server/debugger.ts index 338a34635bf3a..aec3ecbdeeee0 100644 --- a/packages/playwright-core/src/server/debugger.ts +++ b/packages/playwright-core/src/server/debugger.ts @@ -20,7 +20,7 @@ import { SdkObject } from './instrumentation'; import { BrowserContext } from './browserContext'; import type { CallMetadata, InstrumentationListener } from './instrumentation'; -import type { Progress } from '@protocol/progress'; +import type { Progress } from './progress'; const symbol = Symbol('Debugger'); diff --git a/packages/playwright-core/src/server/dialog.ts b/packages/playwright-core/src/server/dialog.ts index dba5b7b51ef41..5faddebf85f01 100644 --- a/packages/playwright-core/src/server/dialog.ts +++ b/packages/playwright-core/src/server/dialog.ts @@ -20,7 +20,7 @@ import { SdkObject } from './instrumentation'; import type { Instrumentation } from './instrumentation'; import type { Page } from './page'; -import type { Progress } from '@protocol/progress'; +import type { Progress } from './progress'; type OnHandle = (accept: boolean, promptText?: string) => Promise; diff --git a/packages/playwright-core/src/server/dispatchers/androidDispatcher.ts b/packages/playwright-core/src/server/dispatchers/androidDispatcher.ts index dc554d8466f16..2ff7e472b181b 100644 --- a/packages/playwright-core/src/server/dispatchers/androidDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/androidDispatcher.ts @@ -22,8 +22,8 @@ import { SdkObject } from '../instrumentation'; import type { RootDispatcher } from './dispatcher'; import type { Android, SocketBackend } from '../android/android'; -import type * as channels from '@protocol/channels'; -import type { Progress } from '@protocol/progress'; +import type * as channels from '../channels'; +import type { Progress } from '../progress'; export class AndroidDispatcher extends Dispatcher implements channels.AndroidChannel { _type_Android = true; @@ -104,7 +104,7 @@ export class AndroidDeviceDispatcher extends Dispatcher { + async info(params: channels.AndroidDeviceInfoParams, progress: Progress): Promise { const info = await this._object.send(progress, 'info', params); fixupAndroidElementInfo(info); return { info }; diff --git a/packages/playwright-core/src/server/dispatchers/artifactDispatcher.ts b/packages/playwright-core/src/server/dispatchers/artifactDispatcher.ts index ff4e0f868bd60..9d6da30e450c8 100644 --- a/packages/playwright-core/src/server/dispatchers/artifactDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/artifactDispatcher.ts @@ -22,8 +22,8 @@ import { StreamDispatcher } from './streamDispatcher'; import type { DispatcherScope } from './dispatcher'; import type { Artifact } from '../artifact'; -import type * as channels from '@protocol/channels'; -import type { Progress } from '@protocol/progress'; +import type * as channels from '../channels'; +import type { Progress } from '../progress'; export class ArtifactDispatcher extends Dispatcher implements channels.ArtifactChannel { _type_Artifact = true; diff --git a/packages/playwright-core/src/server/dispatchers/browserContextDispatcher.ts b/packages/playwright-core/src/server/dispatchers/browserContextDispatcher.ts index 4db2f8adfd955..5c33d784d0200 100644 --- a/packages/playwright-core/src/server/dispatchers/browserContextDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/browserContextDispatcher.ts @@ -46,8 +46,8 @@ import type { Request, Response, RouteHandler } from '../network'; import type { InitScript, Page, PageError } from '../page'; import type { Disposable } from '../disposable'; import type { DispatcherScope } from './dispatcher'; -import type * as channels from '@protocol/channels'; -import type { Progress } from '@protocol/progress'; +import type * as channels from '../channels'; +import type { Progress } from '../progress'; import type { URLMatch } from '@isomorphic/urlMatch'; export class BrowserContextDispatcher extends Dispatcher implements channels.BrowserContextChannel { diff --git a/packages/playwright-core/src/server/dispatchers/browserDispatcher.ts b/packages/playwright-core/src/server/dispatchers/browserDispatcher.ts index 6cc9b81cc1c57..f558a14aefbf7 100644 --- a/packages/playwright-core/src/server/dispatchers/browserDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/browserDispatcher.ts @@ -25,8 +25,8 @@ import { nullProgress } from '../progress'; import type { BrowserTypeDispatcher } from './browserTypeDispatcher'; import type { PageDispatcher } from './pageDispatcher'; import type { CRBrowser } from '../chromium/crBrowser'; -import type * as channels from '@protocol/channels'; -import type { Progress } from '@protocol/progress'; +import type * as channels from '../channels'; +import type { Progress } from '../progress'; type BrowserDispatcherOptions = { // Do not allow to close this browser. diff --git a/packages/playwright-core/src/server/dispatchers/browserTypeDispatcher.ts b/packages/playwright-core/src/server/dispatchers/browserTypeDispatcher.ts index dc0d005c1079a..8c94c7d52b78b 100644 --- a/packages/playwright-core/src/server/dispatchers/browserTypeDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/browserTypeDispatcher.ts @@ -21,8 +21,8 @@ import { Dispatcher } from './dispatcher'; import type { BrowserType } from '../browserType'; import type { RootDispatcher } from './dispatcher'; -import type * as channels from '@protocol/channels'; -import type { Progress } from '@protocol/progress'; +import type * as channels from '../channels'; +import type { Progress } from '../progress'; export class BrowserTypeDispatcher extends Dispatcher implements channels.BrowserTypeChannel { _type_BrowserType = true; diff --git a/packages/playwright-core/src/server/dispatchers/cdpSessionDispatcher.ts b/packages/playwright-core/src/server/dispatchers/cdpSessionDispatcher.ts index 7a89312d2fda0..c67ee2321f4f3 100644 --- a/packages/playwright-core/src/server/dispatchers/cdpSessionDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/cdpSessionDispatcher.ts @@ -19,8 +19,8 @@ import { CDPSession } from '../chromium/crConnection'; import type { BrowserContextDispatcher } from './browserContextDispatcher'; import type { BrowserDispatcher } from './browserDispatcher'; -import type * as channels from '@protocol/channels'; -import type { Progress } from '@protocol/progress'; +import type * as channels from '../channels'; +import type { Progress } from '../progress'; export class CDPSessionDispatcher extends Dispatcher implements channels.CDPSessionChannel { _type_CDPSession = true; diff --git a/packages/playwright-core/src/server/dispatchers/debugControllerDispatcher.ts b/packages/playwright-core/src/server/dispatchers/debugControllerDispatcher.ts index 0c1dc7bbb69e9..d1b44ccc64ad8 100644 --- a/packages/playwright-core/src/server/dispatchers/debugControllerDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/debugControllerDispatcher.ts @@ -20,8 +20,8 @@ import { Dispatcher } from './dispatcher'; import type { DispatcherConnection, RootDispatcher } from './dispatcher'; import type { RegisteredListener } from '@utils/eventsHelper'; -import type * as channels from '@protocol/channels'; -import type { Progress } from '@protocol/progress'; +import type * as channels from '../channels'; +import type { Progress } from '../progress'; export class DebugControllerDispatcher extends Dispatcher implements channels.DebugControllerChannel { diff --git a/packages/playwright-core/src/server/dispatchers/debuggerDispatcher.ts b/packages/playwright-core/src/server/dispatchers/debuggerDispatcher.ts index 6dcd7ef7eca27..40626750b1728 100644 --- a/packages/playwright-core/src/server/dispatchers/debuggerDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/debuggerDispatcher.ts @@ -19,8 +19,8 @@ import { Dispatcher } from './dispatcher'; import { Debugger } from '../debugger'; import type { BrowserContextDispatcher } from './browserContextDispatcher'; -import type * as channels from '@protocol/channels'; -import type { Progress } from '@protocol/progress'; +import type * as channels from '../channels'; +import type { Progress } from '../progress'; export class DebuggerDispatcher extends Dispatcher implements channels.DebuggerChannel { _type_Debugger = true; diff --git a/packages/playwright-core/src/server/dispatchers/dialogDispatcher.ts b/packages/playwright-core/src/server/dispatchers/dialogDispatcher.ts index d9a8172654b18..376be8b0c0a66 100644 --- a/packages/playwright-core/src/server/dispatchers/dialogDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/dialogDispatcher.ts @@ -19,8 +19,8 @@ import { PageDispatcher } from './pageDispatcher'; import type { Dialog } from '../dialog'; import type { BrowserContextDispatcher } from './browserContextDispatcher'; -import type * as channels from '@protocol/channels'; -import type { Progress } from '@protocol/progress'; +import type * as channels from '../channels'; +import type { Progress } from '../progress'; export class DialogDispatcher extends Dispatcher implements channels.DialogChannel { _type_Dialog = true; diff --git a/packages/playwright-core/src/server/dispatchers/dispatcher.ts b/packages/playwright-core/src/server/dispatchers/dispatcher.ts index 50460099f42a0..292c5445c186a 100644 --- a/packages/playwright-core/src/server/dispatchers/dispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/dispatcher.ts @@ -33,7 +33,7 @@ import type { CallMetadata } from '../instrumentation'; import type { PlaywrightDispatcher } from './playwrightDispatcher'; import type { RegisteredListener } from '@utils/eventsHelper'; import type { ValidatorContext } from '../../protocol/validator'; -import type * as channels from '@protocol/channels'; +import type * as channels from '../channels'; const metadataValidator = createMetadataValidator(); const waitInfoValidator = createWaitInfoValidator(); diff --git a/packages/playwright-core/src/server/dispatchers/disposableDispatcher.ts b/packages/playwright-core/src/server/dispatchers/disposableDispatcher.ts index c60bb45f149bc..f4e40116758cb 100644 --- a/packages/playwright-core/src/server/dispatchers/disposableDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/disposableDispatcher.ts @@ -18,8 +18,8 @@ import { Dispatcher } from './dispatcher'; import type { DisposableObject } from '../disposable'; import type { DispatcherScope } from './dispatcher'; -import type * as channels from '@protocol/channels'; -import type { Progress } from '@protocol/progress'; +import type * as channels from '../channels'; +import type { Progress } from '../progress'; export class DisposableDispatcher extends Dispatcher implements channels.DisposableChannel { _type_Disposable = true; diff --git a/packages/playwright-core/src/server/dispatchers/electronDispatcher.ts b/packages/playwright-core/src/server/dispatchers/electronDispatcher.ts index 4dcf68d0d1db6..b70258558385c 100644 --- a/packages/playwright-core/src/server/dispatchers/electronDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/electronDispatcher.ts @@ -23,8 +23,8 @@ import type { RootDispatcher } from './dispatcher'; import type { PageDispatcher } from './pageDispatcher'; import type { ConsoleMessage } from '../console'; import type { Electron } from '../electron/electron'; -import type * as channels from '@protocol/channels'; -import type { Progress } from '@protocol/progress'; +import type * as channels from '../channels'; +import type { Progress } from '../progress'; export class ElectronDispatcher extends Dispatcher implements channels.ElectronChannel { diff --git a/packages/playwright-core/src/server/dispatchers/elementHandlerDispatcher.ts b/packages/playwright-core/src/server/dispatchers/elementHandlerDispatcher.ts index 899c71a0db103..639040930cc5a 100644 --- a/packages/playwright-core/src/server/dispatchers/elementHandlerDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/elementHandlerDispatcher.ts @@ -21,8 +21,8 @@ import { JSHandleDispatcher, parseArgument, serializeResult } from './jsHandleDi import type { ElementHandle } from '../dom'; import type { Frame } from '../frames'; import type * as js from '../javascript'; -import type * as channels from '@protocol/channels'; -import type { Progress } from '@protocol/progress'; +import type * as channels from '../channels'; +import type { Progress } from '../progress'; export class ElementHandleDispatcher extends JSHandleDispatcher implements channels.ElementHandleChannel { diff --git a/packages/playwright-core/src/server/dispatchers/frameDispatcher.ts b/packages/playwright-core/src/server/dispatchers/frameDispatcher.ts index 8c7af45a22d1c..f8b58d74ed22a 100644 --- a/packages/playwright-core/src/server/dispatchers/frameDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/frameDispatcher.ts @@ -25,7 +25,7 @@ import type { Progress } from '../progress'; import type { BrowserContextDispatcher } from './browserContextDispatcher'; import type { PageDispatcher } from './pageDispatcher'; import type { NavigationEvent } from '../frames'; -import type * as channels from '@protocol/channels'; +import type * as channels from '../channels'; export class FrameDispatcher extends Dispatcher implements channels.FrameChannel { _type_Frame = true; diff --git a/packages/playwright-core/src/server/dispatchers/jsHandleDispatcher.ts b/packages/playwright-core/src/server/dispatchers/jsHandleDispatcher.ts index 0155587d1a238..c2da3199ba6d3 100644 --- a/packages/playwright-core/src/server/dispatchers/jsHandleDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/jsHandleDispatcher.ts @@ -22,8 +22,8 @@ import type * as js from '../javascript'; import type { ElectronApplicationDispatcher } from './electronDispatcher'; import type { FrameDispatcher } from './frameDispatcher'; import type { PageDispatcher, WorkerDispatcher } from './pageDispatcher'; -import type * as channels from '@protocol/channels'; -import type { Progress } from '@protocol/progress'; +import type * as channels from '../channels'; +import type { Progress } from '../progress'; export type JSHandleDispatcherParentScope = PageDispatcher | FrameDispatcher | WorkerDispatcher | ElectronApplicationDispatcher; diff --git a/packages/playwright-core/src/server/dispatchers/jsonPipeDispatcher.ts b/packages/playwright-core/src/server/dispatchers/jsonPipeDispatcher.ts index 0b7e676c40686..e334e18256a20 100644 --- a/packages/playwright-core/src/server/dispatchers/jsonPipeDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/jsonPipeDispatcher.ts @@ -18,8 +18,8 @@ import { Dispatcher } from './dispatcher'; import { SdkObject } from '../instrumentation'; import type { LocalUtilsDispatcher } from './localUtilsDispatcher'; -import type * as channels from '@protocol/channels'; -import type { Progress } from '@protocol/progress'; +import type * as channels from '../channels'; +import type { Progress } from '../progress'; export class JsonPipeDispatcher extends Dispatcher implements channels.JsonPipeChannel { _type_JsonPipe = true; diff --git a/packages/playwright-core/src/server/dispatchers/localUtilsDispatcher.ts b/packages/playwright-core/src/server/dispatchers/localUtilsDispatcher.ts index e98254eb71a98..33268afada409 100644 --- a/packages/playwright-core/src/server/dispatchers/localUtilsDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/localUtilsDispatcher.ts @@ -31,7 +31,7 @@ import { WebSocketTransport } from '../transport'; import type { HarBackend } from '../harBackend'; import type { Playwright } from '../playwright'; import type { RootDispatcher } from './dispatcher'; -import type * as channels from '@protocol/channels'; +import type * as channels from '../channels'; import type * as http from 'http'; import type { HTTPRequestParams } from '@utils/network'; diff --git a/packages/playwright-core/src/server/dispatchers/networkDispatchers.ts b/packages/playwright-core/src/server/dispatchers/networkDispatchers.ts index 4e5cf55807500..8a7cfd3e8412e 100644 --- a/packages/playwright-core/src/server/dispatchers/networkDispatchers.ts +++ b/packages/playwright-core/src/server/dispatchers/networkDispatchers.ts @@ -26,8 +26,8 @@ import type { Response, Route } from '../network'; import type { BrowserContextDispatcher } from './browserContextDispatcher'; import type { RootDispatcher } from './dispatcher'; import type { PageDispatcher } from './pageDispatcher'; -import type * as channels from '@protocol/channels'; -import type { Progress } from '@protocol/progress'; +import type * as channels from '../channels'; +import type { Progress } from '../progress'; export class RequestDispatcher extends Dispatcher implements channels.RequestChannel { _type_Request: boolean; diff --git a/packages/playwright-core/src/server/dispatchers/pageDispatcher.ts b/packages/playwright-core/src/server/dispatchers/pageDispatcher.ts index 7fc4d2231e18c..531e168971bd8 100644 --- a/packages/playwright-core/src/server/dispatchers/pageDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/pageDispatcher.ts @@ -46,8 +46,8 @@ import type { InitScript } from '../page'; import type { Disposable } from '../disposable'; import type { BrowserTypeDispatcher } from './browserTypeDispatcher'; import type { ConsoleMessage } from '../console'; -import type * as channels from '@protocol/channels'; -import type { Progress } from '@protocol/progress'; +import type * as channels from '../channels'; +import type { Progress } from '../progress'; import type { URLMatch } from '@isomorphic/urlMatch'; import type { ScreencastFrame } from '../types'; import type { ScreencastClient } from '../screencast'; diff --git a/packages/playwright-core/src/server/dispatchers/playwrightDispatcher.ts b/packages/playwright-core/src/server/dispatchers/playwrightDispatcher.ts index 09a3b1dc8dcd1..6c12d1a1f57ed 100644 --- a/packages/playwright-core/src/server/dispatchers/playwrightDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/playwrightDispatcher.ts @@ -33,8 +33,8 @@ import type { RegisteredListener } from '@utils/eventsHelper'; import type { AndroidDevice } from '../android/android'; import type { Browser } from '../browser'; import type { Playwright } from '../playwright'; -import type * as channels from '@protocol/channels'; -import type { Progress } from '@protocol/progress'; +import type * as channels from '../channels'; +import type { Progress } from '../progress'; export type PlaywrightDispatcherOptions = { socksProxy?: SocksProxy; diff --git a/packages/playwright-core/src/server/dispatchers/streamDispatcher.ts b/packages/playwright-core/src/server/dispatchers/streamDispatcher.ts index c6b26d68d7b42..7ca88618d40cc 100644 --- a/packages/playwright-core/src/server/dispatchers/streamDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/streamDispatcher.ts @@ -19,9 +19,9 @@ import { Dispatcher } from './dispatcher'; import { SdkObject } from '../instrumentation'; import type { ArtifactDispatcher } from './artifactDispatcher'; -import type * as channels from '@protocol/channels'; +import type * as channels from '../channels'; import type * as stream from 'stream'; -import type { Progress } from '@protocol/progress'; +import type { Progress } from '../progress'; class StreamSdkObject extends SdkObject { readonly stream: stream.Readable; diff --git a/packages/playwright-core/src/server/dispatchers/tracingDispatcher.ts b/packages/playwright-core/src/server/dispatchers/tracingDispatcher.ts index f52c02f48a920..950ab8401bb89 100644 --- a/packages/playwright-core/src/server/dispatchers/tracingDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/tracingDispatcher.ts @@ -22,8 +22,8 @@ import type { BrowserContextDispatcher } from './browserContextDispatcher'; import type { APIRequestContextDispatcher } from './networkDispatchers'; import type { PageDispatcher } from './pageDispatcher'; import type { Tracing } from '../trace/recorder/tracing'; -import type * as channels from '@protocol/channels'; -import type { Progress } from '@protocol/progress'; +import type * as channels from '../channels'; +import type { Progress } from '../progress'; export class TracingDispatcher extends Dispatcher implements channels.TracingChannel { _type_Tracing = true; diff --git a/packages/playwright-core/src/server/dispatchers/webSocketRouteDispatcher.ts b/packages/playwright-core/src/server/dispatchers/webSocketRouteDispatcher.ts index dc33c47af92e2..6400947ac0a3d 100644 --- a/packages/playwright-core/src/server/dispatchers/webSocketRouteDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/webSocketRouteDispatcher.ts @@ -27,8 +27,8 @@ import type { BrowserContext } from '../browserContext'; import type { DispatcherConnection } from './dispatcher'; import type { Frame } from '../frames'; import type * as ws from '@injected/webSocketMock'; -import type * as channels from '@protocol/channels'; -import type { Progress } from '@protocol/progress'; +import type * as channels from '../channels'; +import type { Progress } from '../progress'; import type { InitScript, PageBinding } from '../page'; export class WebSocketRouteDispatcher extends Dispatcher implements channels.WebSocketRouteChannel { diff --git a/packages/playwright-core/src/server/dispatchers/writableStreamDispatcher.ts b/packages/playwright-core/src/server/dispatchers/writableStreamDispatcher.ts index ec44c2f227c10..3528c13a2e321 100644 --- a/packages/playwright-core/src/server/dispatchers/writableStreamDispatcher.ts +++ b/packages/playwright-core/src/server/dispatchers/writableStreamDispatcher.ts @@ -20,8 +20,8 @@ import { Dispatcher } from './dispatcher'; import { SdkObject } from '../instrumentation'; import type { BrowserContextDispatcher } from './browserContextDispatcher'; -import type * as channels from '@protocol/channels'; -import type { Progress } from '@protocol/progress'; +import type * as channels from '../channels'; +import type { Progress } from '../progress'; class WritableStreamSdkObject extends SdkObject { readonly streamOrDirectory: fs.WriteStream | string; diff --git a/packages/playwright-core/src/server/dom.ts b/packages/playwright-core/src/server/dom.ts index 3624a05691a3c..872e294f1b6c7 100644 --- a/packages/playwright-core/src/server/dom.ts +++ b/packages/playwright-core/src/server/dom.ts @@ -30,7 +30,7 @@ import type { Page } from './page'; import type { Progress } from './progress'; import type { ScreenshotOptions } from './screenshotter'; import type * as types from './types'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; export type InputFilesItems = { filePayloads?: types.FilePayload[], diff --git a/packages/playwright-core/src/server/electron/electron.ts b/packages/playwright-core/src/server/electron/electron.ts index 4064465579f51..89485c74f33b9 100644 --- a/packages/playwright-core/src/server/electron/electron.ts +++ b/packages/playwright-core/src/server/electron/electron.ts @@ -47,7 +47,7 @@ import type { Page } from '../page'; import type { Playwright } from '../playwright'; import type { Progress } from '../progress'; import type * as types from '../types'; -import type * as channels from '@protocol/channels'; +import type * as channels from '../channels'; import type * as childProcess from 'child_process'; import type { BrowserWindow } from 'electron'; diff --git a/packages/playwright-core/src/server/errors.ts b/packages/playwright-core/src/server/errors.ts index 67ebff9e793f5..1728d28185cec 100644 --- a/packages/playwright-core/src/server/errors.ts +++ b/packages/playwright-core/src/server/errors.ts @@ -17,7 +17,7 @@ import { isError } from '@isomorphic/rtti'; import { parseSerializedValue, serializeValue } from '../protocol/serializers'; -import type { SerializedError } from '@protocol/channels'; +import type { SerializedError } from './channels'; class CustomError extends Error { constructor(message: string) { diff --git a/packages/playwright-core/src/server/fetch.ts b/packages/playwright-core/src/server/fetch.ts index 78bfa6b8640c6..f048bd2a3659b 100644 --- a/packages/playwright-core/src/server/fetch.ts +++ b/packages/playwright-core/src/server/fetch.ts @@ -45,7 +45,7 @@ import type * as types from './types'; import type { HeadersArray, ProxySettings } from './types'; import type { HTTPCredentials } from '../../types/types'; import type { RegisteredListener } from '@utils/eventsHelper'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; import type * as har from '@trace/har'; import type { LookupAddress } from 'dns'; import type { Readable, TransformCallback } from 'stream'; diff --git a/packages/playwright-core/src/server/fileUploadUtils.ts b/packages/playwright-core/src/server/fileUploadUtils.ts index 033c0bed040d4..2ee26cca50cb7 100644 --- a/packages/playwright-core/src/server/fileUploadUtils.ts +++ b/packages/playwright-core/src/server/fileUploadUtils.ts @@ -23,7 +23,7 @@ import type { WritableStreamDispatcher } from './dispatchers/writableStreamDispa import type { InputFilesItems } from './dom'; import type { Frame } from './frames'; import type * as types from './types'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; // Keep in sync with the client. export const fileUploadSizeLimit = 50 * 1024 * 1024; diff --git a/packages/playwright-core/src/server/firefox/ffBrowser.ts b/packages/playwright-core/src/server/firefox/ffBrowser.ts index 59e8c0c716c22..120e448cd419f 100644 --- a/packages/playwright-core/src/server/firefox/ffBrowser.ts +++ b/packages/playwright-core/src/server/firefox/ffBrowser.ts @@ -30,7 +30,7 @@ import type { ConnectionTransport } from '../transport'; import type * as types from '../types'; import type { FFSession } from './ffConnection'; import type { Protocol } from './protocol'; -import type * as channels from '@protocol/channels'; +import type * as channels from '../channels'; export class FFBrowser extends Browser { private _connection: FFConnection; diff --git a/packages/playwright-core/src/server/firefox/firefox.ts b/packages/playwright-core/src/server/firefox/firefox.ts index 14c43a327cfe5..3e0b505951500 100644 --- a/packages/playwright-core/src/server/firefox/firefox.ts +++ b/packages/playwright-core/src/server/firefox/firefox.ts @@ -30,8 +30,8 @@ import type { ConnectionTransport } from '../transport'; import type * as types from '../types'; import type { RecentLogsCollector } from '@utils/debugLogger'; import type { BrowserContext } from '../browserContext'; -import type * as channels from '@protocol/channels'; -import type { Progress } from '@protocol/progress'; +import type * as channels from '../channels'; +import type { Progress } from '../progress'; export class Firefox extends BrowserType { private _bidiFirefox: BrowserType; diff --git a/packages/playwright-core/src/server/formData.ts b/packages/playwright-core/src/server/formData.ts index e494003e2d072..b0ef5097aaf14 100644 --- a/packages/playwright-core/src/server/formData.ts +++ b/packages/playwright-core/src/server/formData.ts @@ -15,7 +15,7 @@ */ import mime from 'mime'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; export class MultipartFormData { private readonly _boundary: string; diff --git a/packages/playwright-core/src/server/frames.ts b/packages/playwright-core/src/server/frames.ts index 31fdaca340b9e..31cf16e285c17 100644 --- a/packages/playwright-core/src/server/frames.ts +++ b/packages/playwright-core/src/server/frames.ts @@ -47,7 +47,7 @@ import type { Progress } from './progress'; import type { ScreenshotOptions } from './screenshotter'; import type { RegisteredListener } from '@utils/eventsHelper'; import type { ParsedSelector } from '@isomorphic/selectorParser'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; type ContextData = { contextPromise: ManualPromise; diff --git a/packages/playwright-core/src/server/har/harRecorder.ts b/packages/playwright-core/src/server/har/harRecorder.ts index c9f40f013641c..31012fd7aaa8b 100644 --- a/packages/playwright-core/src/server/har/harRecorder.ts +++ b/packages/playwright-core/src/server/har/harRecorder.ts @@ -25,7 +25,7 @@ import type { BrowserContext } from '../browserContext'; import type { HarTracerDelegate } from './harTracer'; import type { Page } from '../page'; import type { NameValue } from '@isomorphic/types'; -import type * as channels from '@protocol/channels'; +import type * as channels from '../channels'; import type * as har from '@trace/har'; export class HarRecorder implements HarTracerDelegate { diff --git a/packages/playwright-core/src/server/instrumentation.ts b/packages/playwright-core/src/server/instrumentation.ts index 729a2ec7d7235..c5730e81a84fc 100644 --- a/packages/playwright-core/src/server/instrumentation.ts +++ b/packages/playwright-core/src/server/instrumentation.ts @@ -19,6 +19,7 @@ import { EventEmitter } from 'events'; import { createGuid } from '@utils/crypto'; import { debugLogger } from '@utils/debugLogger'; +import type { SerializedError } from './channels'; import type { Browser } from './browser'; import type { BrowserContext } from './browserContext'; import type { BrowserType } from './browserType'; @@ -29,8 +30,6 @@ import type { Frame } from './frames'; import type { Page, Worker } from './page'; import type { Playwright } from './playwright'; import type * as types from './types'; -import type { CallMetadata } from '@protocol/callMetadata'; -export type { CallMetadata } from '@protocol/callMetadata'; import type { LogName } from '@utils/debugLogger'; export type Attribution = { @@ -82,6 +81,30 @@ export function createRootSdkObject() { export type AddListenerOptions = { order?: 'last' }; +export type CallMetadata = { + id: string; + startTime: number; + endTime: number; + pauseStartTime?: number; + pauseEndTime?: number; + type: string; + method: string; + params: any; + title?: string; + // Client is making an internal call that should not show up in + // the inspector or trace. + internal?: boolean; + // Test runner step id. + stepId?: string; + location?: { file: string, line?: number, column?: number }; + log: string[]; + error?: SerializedError; + result?: any; + objectId?: string; + pageId?: string; + frameId?: string; +}; + export interface Instrumentation { addListener(listener: InstrumentationListener, context: BrowserContext | APIRequestContext | null, options?: AddListenerOptions): void; removeListener(listener: InstrumentationListener): void; diff --git a/packages/playwright-core/src/server/javascript.ts b/packages/playwright-core/src/server/javascript.ts index e4128a0e8e69f..17aaf1683e229 100644 --- a/packages/playwright-core/src/server/javascript.ts +++ b/packages/playwright-core/src/server/javascript.ts @@ -21,7 +21,7 @@ import { SdkObject } from './instrumentation'; import * as rawUtilityScriptSource from '../generated/utilityScriptSource'; import type * as dom from './dom'; -import type { Progress } from '@protocol/progress'; +import type { Progress } from './progress'; import type { UtilityScript } from '@injected/utilityScript'; interface TaggedAsJSHandle { diff --git a/packages/playwright-core/src/server/localUtils.ts b/packages/playwright-core/src/server/localUtils.ts index 8da82e56b2bbf..c2b36758a6a94 100644 --- a/packages/playwright-core/src/server/localUtils.ts +++ b/packages/playwright-core/src/server/localUtils.ts @@ -27,10 +27,10 @@ import { calculateSha1 } from '@utils/crypto'; import { ZipFile } from '@utils/zipFile'; import { removeFolders, resolveWithinRoot } from '@utils/fileUtils'; import { HarBackend } from './harBackend'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; import type * as har from '@trace/har'; import type EventEmitter from 'events'; -import type { Progress } from '@protocol/progress'; +import type { Progress } from './progress'; export type StackSession = { diff --git a/packages/playwright-core/src/server/network.ts b/packages/playwright-core/src/server/network.ts index db00d5a7039a8..457efb571716f 100644 --- a/packages/playwright-core/src/server/network.ts +++ b/packages/playwright-core/src/server/network.ts @@ -26,8 +26,8 @@ import type * as pages from './page'; import type * as types from './types'; import type { NormalizedContinueOverrides } from './types'; import type { HeadersArray, NameValue } from '@isomorphic/types'; -import type * as channels from '@protocol/channels'; -import type { Progress } from '@protocol/progress'; +import type * as channels from './channels'; +import type { Progress } from './progress'; export function filterCookies(cookies: channels.NetworkCookie[], urls: string[]): channels.NetworkCookie[] { diff --git a/packages/playwright-core/src/server/page.ts b/packages/playwright-core/src/server/page.ts index c26d5d39ddb1a..88407afa0a796 100644 --- a/packages/playwright-core/src/server/page.ts +++ b/packages/playwright-core/src/server/page.ts @@ -51,7 +51,7 @@ import type { Progress } from './progress'; import type { ScreenshotOptions } from './screenshotter'; import type * as types from './types'; import type { ImageComparatorOptions } from '@utils/comparators'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; import type { BindingPayload } from '@injected/bindingsController'; import type { SelectorInfo } from './frameSelectors'; diff --git a/packages/playwright-core/src/server/progress.ts b/packages/playwright-core/src/server/progress.ts index c55bcc0c093e1..22787d0ceee01 100644 --- a/packages/playwright-core/src/server/progress.ts +++ b/packages/playwright-core/src/server/progress.ts @@ -20,10 +20,19 @@ import { monotonicTime } from '@isomorphic/time'; import { debugLogger } from '@utils/debugLogger'; import { TimeoutError } from './errors'; -import type { Progress } from '@protocol/progress'; import type { CallMetadata, SdkObject } from './instrumentation'; -export type { Progress } from '@protocol/progress'; +export interface Progress { + timeout: number; + deadline: number; + disableTimeout(): void; + log(message: string): void; + race(promise: Promise | Promise[]): Promise; + wait(timeout: number): Promise; // timeout = 0 here means "wait 0 ms", not forever. + signal: AbortSignal; + metadata: CallMetadata; + setAllowConcurrentOrNestedRaces(allow: boolean): void; +} export class ProgressController { private _forceAbortPromise = new ManualPromise(); diff --git a/packages/playwright-core/src/server/recorder.ts b/packages/playwright-core/src/server/recorder.ts index 925520399bc17..360431911b222 100644 --- a/packages/playwright-core/src/server/recorder.ts +++ b/packages/playwright-core/src/server/recorder.ts @@ -39,7 +39,7 @@ import type { CallMetadata, InstrumentationListener, SdkObject } from './instrum import type { Point } from '@isomorphic/types'; import type { AriaTemplateNode } from '@isomorphic/ariaSnapshot'; import type { Progress } from './progress'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; import type * as actions from '@recorder/actions'; import type { CallLog, CallLogStatus, ElementInfo, Mode, OverlayState, Source, UIState } from '@recorder/recorderTypes'; import type { RegisteredListener } from '@utils/eventsHelper'; diff --git a/packages/playwright-core/src/server/recorder/recorderApp.ts b/packages/playwright-core/src/server/recorder/recorderApp.ts index f85f69574138a..9e6b37e7c5d8d 100644 --- a/packages/playwright-core/src/server/recorder/recorderApp.ts +++ b/packages/playwright-core/src/server/recorder/recorderApp.ts @@ -34,7 +34,7 @@ import type { Page } from '../page'; import type * as actions from '@recorder/actions'; import type { CallLog, ElementInfo, Mode, RecorderBackend, RecorderFrontend, Source } from '@recorder/recorderTypes'; import type { Language, LanguageGeneratorOptions } from '../codegen/types'; -import type * as channels from '@protocol/channels'; +import type * as channels from '../channels'; import type { Progress } from '../progress'; import type { AriaTemplateNode } from '@isomorphic/ariaSnapshot'; diff --git a/packages/playwright-core/src/server/recorder/recorderRunner.ts b/packages/playwright-core/src/server/recorder/recorderRunner.ts index 1123b63fa48c7..125e748396e02 100644 --- a/packages/playwright-core/src/server/recorder/recorderRunner.ts +++ b/packages/playwright-core/src/server/recorder/recorderRunner.ts @@ -14,7 +14,6 @@ * limitations under the License. */ -import { serializeExpectedTextValues } from '@isomorphic/expectUtils'; import { toKeyboardModifiers } from '../codegen/language'; import { buildFullSelector, mainFrameForAction } from './recorderUtils'; import { Progress } from '../progress'; @@ -105,7 +104,7 @@ async function performActionImpl(progress: Progress, mainFrame: Frame, actionInC await mainFrame.expect(progress, selector, { selector, expression: 'to.have.text', - expectedText: serializeExpectedTextValues([action.text], { matchSubstring: true, normalizeWhiteSpace: true }), + expectedText: [{ string: action.text, matchSubstring: true, normalizeWhiteSpace: true }], isNot: false, }); return; diff --git a/packages/playwright-core/src/server/recorder/recorderUtils.ts b/packages/playwright-core/src/server/recorder/recorderUtils.ts index fca4472208ce3..fcbf6c835f6b6 100644 --- a/packages/playwright-core/src/server/recorder/recorderUtils.ts +++ b/packages/playwright-core/src/server/recorder/recorderUtils.ts @@ -24,7 +24,7 @@ import type { CallMetadata } from '../instrumentation'; import type { Page } from '../page'; import type * as actions from '@recorder/actions'; import type { CallLog, CallLogStatus } from '@recorder/recorderTypes'; -import type { Progress } from '@protocol/progress'; +import type { Progress } from '../progress'; export function buildFullSelector(framePath: string[], selector: string) { return [...framePath, selector].join(' >> internal:control=enter-frame >> '); diff --git a/packages/playwright-core/src/server/selectors.ts b/packages/playwright-core/src/server/selectors.ts index 3b90294deb9b4..810dc4640f132 100644 --- a/packages/playwright-core/src/server/selectors.ts +++ b/packages/playwright-core/src/server/selectors.ts @@ -18,7 +18,7 @@ import { InvalidSelectorError, parseSelector, stringifySelector, visitAllSelect import { createGuid } from '@utils/crypto'; import type { ParsedSelector } from '@isomorphic/selectorParser'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; export class Selectors { private readonly _builtinEngines: Set; diff --git a/packages/playwright-core/src/server/socksClientCertificatesInterceptor.ts b/packages/playwright-core/src/server/socksClientCertificatesInterceptor.ts index 3174827e28bd4..412dda56cce87 100644 --- a/packages/playwright-core/src/server/socksClientCertificatesInterceptor.ts +++ b/packages/playwright-core/src/server/socksClientCertificatesInterceptor.ts @@ -32,7 +32,7 @@ import { verifyClientCertificates } from './browserContext'; import type * as types from './types'; import type { SocksSocketClosedPayload, SocksSocketDataPayload, SocksSocketRequestedPayload } from '@utils/socksProxy'; import type https from 'https'; -import type { Progress } from '@protocol/progress'; +import type { Progress } from './progress'; let dummyServerTlsOptions: tls.TlsOptions | undefined = undefined; function loadDummyServerCertsIfNeeded() { diff --git a/packages/playwright-core/src/server/socksInterceptor.ts b/packages/playwright-core/src/server/socksInterceptor.ts index c410ff19bcf2f..9d325dfb31a2f 100644 --- a/packages/playwright-core/src/server/socksInterceptor.ts +++ b/packages/playwright-core/src/server/socksInterceptor.ts @@ -22,7 +22,7 @@ import { ValidationError, findValidator } from '../protocol/validator'; import type { WebSocketTransport } from './transport'; import type { ValidatorContext } from '../protocol/validator'; -import type * as channels from '@protocol/channels'; +import type * as channels from '../client/channels'; // this file lives in server/, but since it runs via localUtils, client channels is still correct. export class SocksInterceptor { private _handler: socks.SocksProxyHandler; diff --git a/packages/playwright-core/src/server/trace/recorder/tracing.ts b/packages/playwright-core/src/server/trace/recorder/tracing.ts index 84af09c2b0e4b..77156a7aa4cb3 100644 --- a/packages/playwright-core/src/server/trace/recorder/tracing.ts +++ b/packages/playwright-core/src/server/trace/recorder/tracing.ts @@ -48,11 +48,11 @@ import type { APIRequestContext } from '../../fetch'; import type { HarTracerDelegate } from '../../har/harTracer'; import type { CallMetadata, InstrumentationListener } from '../../instrumentation'; import type { PageError } from '../../page'; -import type { RecordHarOptions, StackFrame, TracingTracingStopChunkParams } from '@protocol/channels'; +import type { RecordHarOptions, StackFrame, TracingTracingStopChunkParams } from '../../channels'; import type * as har from '@trace/har'; import type { FrameSnapshot } from '@trace/snapshot'; import type * as trace from '@trace/trace'; -import type { Progress } from '@protocol/progress'; +import type { Progress } from '../../progress'; import type * as types from '../../types'; import type { Screencast, ScreencastClient } from '../../screencast'; diff --git a/packages/playwright-core/src/server/types.ts b/packages/playwright-core/src/server/types.ts index 25c0f81206b75..33efd23934b69 100644 --- a/packages/playwright-core/src/server/types.ts +++ b/packages/playwright-core/src/server/types.ts @@ -17,7 +17,7 @@ import type { HeadersArray, Point, Size } from '@isomorphic/types'; export type { HeadersArray, Point, Quad, Rect, Size } from '@isomorphic/types'; -import type * as channels from '@protocol/channels'; +import type * as channels from './channels'; import type { ProxySettings } from '@utils/network'; export type StrictOptions = { diff --git a/packages/playwright-core/src/server/webkit/webkit.ts b/packages/playwright-core/src/server/webkit/webkit.ts index 1b90404a296dd..101e312e0f1bc 100644 --- a/packages/playwright-core/src/server/webkit/webkit.ts +++ b/packages/playwright-core/src/server/webkit/webkit.ts @@ -33,7 +33,7 @@ import type { Progress } from '../progress'; import type { ConnectionTransport } from '../transport'; import type * as types from '../types'; import type { RecentLogsCollector } from '@utils/debugLogger'; -import type * as channels from '@protocol/channels'; +import type * as channels from '../channels'; // Must be kept in sync with bin/install_webkit_wsl.ps1 that provisions the distribution. const kWSLDistribution = 'playwright'; diff --git a/packages/playwright-core/src/server/webkit/webview/wvBrowser.ts b/packages/playwright-core/src/server/webkit/webview/wvBrowser.ts index 509890ce30637..313f3ab0ae8a9 100644 --- a/packages/playwright-core/src/server/webkit/webview/wvBrowser.ts +++ b/packages/playwright-core/src/server/webkit/webview/wvBrowser.ts @@ -37,7 +37,7 @@ import type { SdkObject } from '../../instrumentation'; import type { InitScript, Page } from '../../page'; import type { ProtocolRequest, ProtocolResponse } from '../../transport'; import type * as types from '../../types'; -import type * as channels from '@protocol/channels'; +import type * as channels from '../../channels'; import type { Progress } from '../../progress'; import type { ConnectOverCDPTransport } from '../../../../types/types.d.ts'; diff --git a/packages/playwright-core/src/server/webkit/webview/wvPage.ts b/packages/playwright-core/src/server/webkit/webview/wvPage.ts index 93f8f8a611e10..9429cf9f576f8 100644 --- a/packages/playwright-core/src/server/webkit/webview/wvPage.ts +++ b/packages/playwright-core/src/server/webkit/webview/wvPage.ts @@ -47,7 +47,7 @@ import type { JSHandle } from '../../javascript'; import type { InitScript, PageDelegate } from '../../page'; import type { Progress } from '../../progress'; import type * as types from '../../types'; -import type { PagePdfParams } from '@protocol/channels'; +import type { PagePdfParams } from '../../channels'; export class WVPage implements PageDelegate { readonly rawMouse: RawMouseImpl; diff --git a/packages/playwright-core/src/server/webkit/wkBrowser.ts b/packages/playwright-core/src/server/webkit/wkBrowser.ts index ffdd5d18e92e7..a46a7e51729e3 100644 --- a/packages/playwright-core/src/server/webkit/wkBrowser.ts +++ b/packages/playwright-core/src/server/webkit/wkBrowser.ts @@ -30,7 +30,7 @@ import type { ConnectionTransport } from '../transport'; import type * as types from '../types'; import type { Protocol } from './protocol'; import type { PageProxyMessageReceivedPayload } from './wkConnection'; -import type * as channels from '@protocol/channels'; +import type * as channels from '../channels'; const BROWSER_VERSION = '26.5'; const DEFAULT_USER_AGENT = `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/${BROWSER_VERSION} Safari/605.1.15`; diff --git a/packages/playwright/src/matchers/expect.ts b/packages/playwright/src/matchers/expect.ts index c4de97609df82..72a6c424e54c4 100644 --- a/packages/playwright/src/matchers/expect.ts +++ b/packages/playwright/src/matchers/expect.ts @@ -88,7 +88,7 @@ import type { MatcherContext, MatchersObject, RawMatcherFn } from './expectLibra import type { MatcherAttachment, MatcherResult } from './matcherHint'; import type { ExpectMatcherStateInternal } from './matchers'; import type { Expect } from '../../types/test'; -import type { StackFrame } from '@protocol/channels'; +import type { StackFrame } from '@isomorphic/stackTrace'; interface ExpectStep { complete(result: { diff --git a/packages/playwright/src/matchers/matcherHint.ts b/packages/playwright/src/matchers/matcherHint.ts index bf8dd14fd6729..4799c9962ea9f 100644 --- a/packages/playwright/src/matchers/matcherHint.ts +++ b/packages/playwright/src/matchers/matcherHint.ts @@ -18,7 +18,7 @@ import util from 'util'; import { stringifyStackFrames } from '@isomorphic/stackTrace'; -import type { StackFrame } from '@protocol/channels'; +import type { StackFrame } from '@isomorphic/stackTrace'; export type MatcherAttachment = { name: string; contentType: string; path?: string; body?: string | Buffer }; diff --git a/packages/playwright/src/matchers/matchers.ts b/packages/playwright/src/matchers/matchers.ts index d2fedd70cdb03..8cd4583b7a031 100644 --- a/packages/playwright/src/matchers/matchers.ts +++ b/packages/playwright/src/matchers/matchers.ts @@ -21,7 +21,6 @@ import { isRegExp } from '@isomorphic/rtti'; import { isString } from '@isomorphic/stringUtils'; import { pollAgainstDeadline } from '@isomorphic/timeoutRunner'; import { constructURLBasedOnBaseURL, isURLPattern } from '@isomorphic/urlMatch'; -import { serializeExpectedTextValues } from '@isomorphic/expectUtils'; import { monotonicTime } from '@isomorphic/index'; import { expectTypes, formatMatcherMessage, MatcherResult } from './matcherHint'; @@ -45,6 +44,26 @@ export type ExpectMatcherStateInternal = Omit & { utils: ExpectMatcherUtils & InternalMatcherUtils; }; +type ExpectedTextValue = { + string?: string, + regexSource?: string, + regexFlags?: string, + matchSubstring?: boolean, + ignoreCase?: boolean, + normalizeWhiteSpace?: boolean, +}; + +function serializeExpectedTextValues(items: (string | RegExp)[], options: { matchSubstring?: boolean, normalizeWhiteSpace?: boolean, ignoreCase?: boolean } = {}): ExpectedTextValue[] { + return items.map(i => ({ + string: isString(i) ? i : undefined, + regexSource: isRegExp(i) ? i.source : undefined, + regexFlags: isRegExp(i) ? i.flags : undefined, + matchSubstring: options.matchSubstring, + ignoreCase: options.ignoreCase, + normalizeWhiteSpace: options.normalizeWhiteSpace, + })); +} + export interface LocatorEx extends Locator { _selector: string; _expect(expression: string, options: FrameExpectParams): Promise; diff --git a/packages/playwright/src/util.ts b/packages/playwright/src/util.ts index 6f6063de5295a..c0c36ec2524b4 100644 --- a/packages/playwright/src/util.ts +++ b/packages/playwright/src/util.ts @@ -27,10 +27,9 @@ import { isRegExp } from '@isomorphic/rtti'; import { parseStackFrame, stringifyStackFrames } from '@isomorphic/stackTrace'; import { ansiRegex, isString, stripAnsiEscapes } from '@isomorphic/stringUtils'; -import type { RawStack } from '@isomorphic/stackTrace'; +import type { RawStack, StackFrame } from '@isomorphic/stackTrace'; import type { Location } from './../types/testReporter'; import type { TestInfoError } from './../types/test'; -import type { StackFrame } from '@protocol/channels'; import type { TestCase } from './common/test'; const PLAYWRIGHT_TEST_PATH = path.join(__dirname, '..'); diff --git a/packages/playwright/src/worker/testInfo.ts b/packages/playwright/src/worker/testInfo.ts index 42b3a7a902c20..58ee006bee26a 100644 --- a/packages/playwright/src/worker/testInfo.ts +++ b/packages/playwright/src/worker/testInfo.ts @@ -35,7 +35,7 @@ import type { RunnableDescription } from './timeoutManager'; import type { FullProject, TestInfo, TestInfoError, TestStatus, TestStepInfo, TestAnnotation } from '../../types/test'; import type { FullConfig, Location } from '../../types/testReporter'; import type { config as commonConfig, FullConfigInternal, test as testNs } from '../common'; -import type { StackFrame } from '@protocol/channels'; +import type { StackFrame } from '@isomorphic/stackTrace'; export type TestStepCategory = 'expect' | 'fixture' | 'hook' | 'pw:api' | 'test.step' | 'test.attach'; diff --git a/packages/playwright/src/worker/testTracing.ts b/packages/playwright/src/worker/testTracing.ts index 70b6a5c28e738..d6373496f55ba 100644 --- a/packages/playwright/src/worker/testTracing.ts +++ b/packages/playwright/src/worker/testTracing.ts @@ -29,7 +29,7 @@ import { filteredStackTrace } from '../util'; import type { TestStepCategory, TestInfoImpl } from './testInfo'; import type { PlaywrightWorkerOptions, TestInfo, TestInfoError, TraceMode } from '../../types/test'; -import type { SerializedError, StackFrame } from '@protocol/channels'; +import type { StackFrame } from '@isomorphic/stackTrace'; import type * as trace from '@trace/trace'; import type EventEmitter from 'events'; @@ -291,7 +291,7 @@ export class TestTracing { }); } - appendAfterActionForStep(callId: string, error?: SerializedError['error'], attachments: Attachment[] = [], annotations?: trace.AfterActionTraceEventAnnotation[]) { + appendAfterActionForStep(callId: string, error?: trace.SerializedError['error'], attachments: Attachment[] = [], annotations?: trace.AfterActionTraceEventAnnotation[]) { this._appendTraceEvent({ type: 'after', callId, diff --git a/packages/protocol/src/callMetadata.d.ts b/packages/protocol/src/callMetadata.d.ts deleted file mode 100644 index 9fea3cea2a7be..0000000000000 --- a/packages/protocol/src/callMetadata.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import type { SerializedError } from './channels'; - -export type CallMetadata = { - id: string; - startTime: number; - endTime: number; - pauseStartTime?: number; - pauseEndTime?: number; - type: string; - method: string; - params: any; - title?: string; - // Client is making an internal call that should not show up in - // the inspector or trace. - internal?: boolean; - // Test runner step id. - stepId?: string; - location?: { file: string, line?: number, column?: number }; - log: string[]; - error?: SerializedError; - result?: any; - objectId?: string; - pageId?: string; - frameId?: string; -}; diff --git a/packages/protocol/src/progress.d.ts b/packages/protocol/src/progress.d.ts deleted file mode 100644 index 72280b317b4ec..0000000000000 --- a/packages/protocol/src/progress.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import type { CallMetadata } from './callMetadata'; - -// Most server operations are run inside a Progress instance, which is conceptually -// similar to a cancellation token. -// -// Each method that takes a Progress must result in one of the three outcomes: -// - It finishes successfully, returning a value, before the Progress is aborted. -// - It throws some error, before the Progress is aborted. -// - It throws the Progress's aborted error, because the Progress was aborted before -// the method could finish. -// -// As a rule of thumb, the above is achieved by: -// - Passing the Progress instance when awaiting other methods. -// - Using `progress.race()` when awaiting other methods that do not take a Progress argument. -// In this case, it is important that awaited method has no side effects, for example -// it is a read-only browser protocol call. -export interface Progress { - timeout: number; - deadline: number; - disableTimeout(): void; - log(message: string): void; - race(promise: Promise | Promise[]): Promise; - wait(timeout: number): Promise; // timeout = 0 here means "wait 0 ms", not forever. - signal: AbortSignal; - metadata: CallMetadata; - setAllowConcurrentOrNestedRaces(allow: boolean): void; -} diff --git a/packages/recorder/vite.config.ts b/packages/recorder/vite.config.ts index 921cb4b575c34..50663c4debfc4 100644 --- a/packages/recorder/vite.config.ts +++ b/packages/recorder/vite.config.ts @@ -27,7 +27,6 @@ export default defineConfig({ resolve: { alias: { '@isomorphic': path.resolve(__dirname, '../isomorphic'), - '@protocol': path.resolve(__dirname, '../protocol/src'), '@web': path.resolve(__dirname, '../web/src'), }, }, diff --git a/packages/trace-viewer/src/ui/callTab.tsx b/packages/trace-viewer/src/ui/callTab.tsx index 69da4e94c1089..fccc85722472d 100644 --- a/packages/trace-viewer/src/ui/callTab.tsx +++ b/packages/trace-viewer/src/ui/callTab.tsx @@ -14,8 +14,7 @@ * limitations under the License. */ -import type { SerializedValue } from '@protocol/channels'; -import type { ActionTraceEvent } from '@trace/trace'; +import type { ActionTraceEvent, SerializedValue } from '@trace/trace'; import { clsx } from '@web/uiUtils'; import { msToString } from '@isomorphic/formatUtils'; import * as React from 'react'; diff --git a/packages/trace-viewer/src/ui/consoleTab.tsx b/packages/trace-viewer/src/ui/consoleTab.tsx index 16d5809d2ba91..e82f80f8d4064 100644 --- a/packages/trace-viewer/src/ui/consoleTab.tsx +++ b/packages/trace-viewer/src/ui/consoleTab.tsx @@ -14,7 +14,7 @@ * limitations under the License. */ -import type * as channels from '@protocol/channels'; +import type { SerializedError } from '@trace/trace'; import * as React from 'react'; import './consoleTab.css'; import type { TraceModel } from '@isomorphic/trace/traceModel'; @@ -31,7 +31,7 @@ export type ConsoleEntry = { bodyString: string; location: string; }, - browserError?: channels.SerializedError; + browserError?: SerializedError; nodeMessage?: { html: string; }, diff --git a/packages/trace-viewer/src/ui/sourceTab.tsx b/packages/trace-viewer/src/ui/sourceTab.tsx index 4cbca74d0cf23..a6c9ad9531b2f 100644 --- a/packages/trace-viewer/src/ui/sourceTab.tsx +++ b/packages/trace-viewer/src/ui/sourceTab.tsx @@ -22,7 +22,7 @@ import { StackTraceView } from './stackTrace'; import { CodeMirrorWrapper } from '@web/components/codeMirrorWrapper'; import type { SourceHighlight } from '@web/components/codeMirrorWrapper'; import type { SourceLocation, SourceModel } from '@isomorphic/trace/traceModel'; -import type { StackFrame } from '@protocol/channels'; +import type { StackFrame } from '@isomorphic/stackTrace'; import { CopyToClipboard } from './copyToClipboard'; import { ToolbarButton } from '@web/components/toolbarButton'; import { Toolbar } from '@web/components/toolbar'; diff --git a/packages/trace-viewer/src/ui/stackTrace.tsx b/packages/trace-viewer/src/ui/stackTrace.tsx index f0e79cd673b53..d03879631c296 100644 --- a/packages/trace-viewer/src/ui/stackTrace.tsx +++ b/packages/trace-viewer/src/ui/stackTrace.tsx @@ -17,7 +17,7 @@ import * as React from 'react'; import './stackTrace.css'; import { ListView } from '@web/components/listView'; -import type { StackFrame } from '@protocol/channels'; +import type { StackFrame } from '@isomorphic/stackTrace'; const StackFrameListView = ListView; diff --git a/packages/trace-viewer/vite.config.ts b/packages/trace-viewer/vite.config.ts index 3d0f63e65e558..fbb0a6883c5e4 100644 --- a/packages/trace-viewer/vite.config.ts +++ b/packages/trace-viewer/vite.config.ts @@ -36,7 +36,6 @@ export default defineConfig({ alias: { '@injected': path.resolve(__dirname, '../injected/src'), '@isomorphic': path.resolve(__dirname, '../isomorphic'), - '@protocol': path.resolve(__dirname, '../protocol/src'), '@testIsomorphic': path.resolve(__dirname, '../playwright/src/isomorphic'), '@trace': path.resolve(__dirname, '../trace/src'), '@web': path.resolve(__dirname, '../web/src'), diff --git a/packages/trace/src/trace.ts b/packages/trace/src/trace.ts index d11ac4dc91045..6cdfbdfc3b70f 100644 --- a/packages/trace/src/trace.ts +++ b/packages/trace/src/trace.ts @@ -16,10 +16,51 @@ import type { FrameSnapshot, ResourceSnapshot } from './snapshot'; import type { Language } from '@isomorphic/locatorGenerators'; -import type { Point, SerializedError, StackFrame } from '@protocol/channels'; +import type { StackFrame } from '@isomorphic/stackTrace'; +import type { Point } from '@isomorphic/types'; export type Size = { width: number, height: number }; +export type SerializedValue = { + n?: number, + b?: boolean, + s?: string, + v?: 'null' | 'undefined' | 'NaN' | 'Infinity' | '-Infinity' | '-0', + d?: string, + u?: string, + bi?: string, + ta?: { + b: Buffer, + k: 'i8' | 'ui8' | 'ui8c' | 'i16' | 'ui16' | 'i32' | 'ui32' | 'f32' | 'f64' | 'bi64' | 'bui64', + }, + e?: { + m: string, + n: string, + s: string, + }, + r?: { + p: string, + f: string, + }, + a?: SerializedValue[], + o?: { + k: string, + v: SerializedValue, + }[], + h?: number, + id?: number, + ref?: number, +}; + +export type SerializedError = { + error?: { + message: string, + name: string, + stack?: string, + }, + value?: SerializedValue, +}; + // Make sure you add _modernize_N_to_N1(event: any) to traceModernizer.ts. export type VERSION = 8; diff --git a/packages/utils/nodePlatform.ts b/packages/utils/nodePlatform.ts index 9c3f8b38f65c8..ab0811e1efae0 100644 --- a/packages/utils/nodePlatform.ts +++ b/packages/utils/nodePlatform.ts @@ -26,9 +26,8 @@ import { debugLogger } from './debugLogger'; import { currentZone, emptyZone } from './zones'; import { debugMode, isUnderTest } from './debug'; -import type { Platform, Zone } from '@isomorphic/platform'; +import type { Platform, StreamChannel, WritableStreamChannel, Zone } from '@isomorphic/platform'; import type { Zone as ZoneImpl } from './zones'; -import type * as channels from '@protocol/channels'; const pipelineAsync = util.promisify(pipeline); @@ -113,11 +112,11 @@ export const nodePlatform: (coreDir: string) => Platform = coreDir => ({ await pipelineAsync(fs.createReadStream(path), stream); }, - streamReadable: (channel: channels.StreamChannel) => { + streamReadable: (channel: StreamChannel) => { return new ReadableStreamImpl(channel); }, - streamWritable: (channel: channels.WritableStreamChannel) => { + streamWritable: (channel: WritableStreamChannel) => { return new WritableStreamImpl(channel); }, @@ -128,9 +127,9 @@ export const nodePlatform: (coreDir: string) => Platform = coreDir => ({ }); class ReadableStreamImpl extends Readable { - private _channel: channels.StreamChannel; + private _channel: StreamChannel; - constructor(channel: channels.StreamChannel) { + constructor(channel: StreamChannel) { super(); this._channel = channel; } @@ -151,9 +150,9 @@ class ReadableStreamImpl extends Readable { } class WritableStreamImpl extends Writable { - private _channel: channels.WritableStreamChannel; + private _channel: WritableStreamChannel; - constructor(channel: channels.WritableStreamChannel) { + constructor(channel: WritableStreamChannel) { super(); this._channel = channel; } diff --git a/tests/config/debugControllerBackend.ts b/tests/config/debugControllerBackend.ts index 9f67d44e50d34..1c90a5c468c5a 100644 --- a/tests/config/debugControllerBackend.ts +++ b/tests/config/debugControllerBackend.ts @@ -16,7 +16,7 @@ import WebSocket from 'ws'; import { EventEmitter } from 'events'; -import type * as channels from '@protocol/channels'; +import type * as channels from '../../packages/playwright-core/src/client/channels'; export type ProtocolRequest = { id: number; diff --git a/tests/config/utils.ts b/tests/config/utils.ts index f39363a61f344..dcc8d7c6ebfc7 100644 --- a/tests/config/utils.ts +++ b/tests/config/utils.ts @@ -19,7 +19,7 @@ import { utils, iso } from '../../packages/playwright-core/lib/coreBundle'; import type { iso as isoType } from '../../packages/playwright-core/lib/coreBundle'; import type { Locator, Frame, Page } from 'playwright-core'; -import type { StackFrame } from '../../packages/protocol/src/channels'; +import type { StackFrame } from '../../packages/isomorphic/stackTrace'; import type { ActionTraceEvent, TraceEvent } from '@trace/trace'; const { TraceLoader, TraceModel } = iso; diff --git a/tests/library/debug-controller.spec.ts b/tests/library/debug-controller.spec.ts index 90f26ef4ddf39..7d70a2264757a 100644 --- a/tests/library/debug-controller.spec.ts +++ b/tests/library/debug-controller.spec.ts @@ -19,7 +19,7 @@ import { remote, utils } from '../../packages/playwright-core/lib/coreBundle'; const { PlaywrightServer } = remote; import { Backend } from '../config/debugControllerBackend'; import type { Browser, BrowserContext } from '@playwright/test'; -import type * as channels from '@protocol/channels'; +import type * as channels from '../../packages/playwright-core/src/client/channels'; import { roundBox } from '../config/utils'; const { createGuid } = utils; diff --git a/tests/library/tracing.spec.ts b/tests/library/tracing.spec.ts index b565683b6d2d7..68258bb58e69e 100644 --- a/tests/library/tracing.spec.ts +++ b/tests/library/tracing.spec.ts @@ -19,7 +19,7 @@ import { jpegjs } from 'playwright-core/lib/utilsBundle'; import path from 'path'; import { browserTest, contextTest as test, expect } from '../config/browserTest'; import { parseTraceRaw } from '../config/utils'; -import type { StackFrame } from '@protocol/channels'; +import type { StackFrame } from '../../packages/isomorphic/stackTrace'; import type { ActionTraceEvent } from '../../packages/trace/src/trace'; import { artifactsFolderName } from '../../packages/playwright/src/isomorphic/folders'; import { rafraf } from '../page/pageTest'; diff --git a/tests/tsconfig.json b/tests/tsconfig.json index d9df9e1380ed8..ad46142a25302 100644 --- a/tests/tsconfig.json +++ b/tests/tsconfig.json @@ -16,7 +16,6 @@ "@isomorphic/*": ["packages/isomorphic/*"], "@utils/*": ["packages/utils/*"], "@testIsomorphic/*": ["packages/playwright/src/isomorphic/*"], - "@protocol/*": ["packages/protocol/src/*"], "@recorder/*": ["packages/recorder/src/*"], "@trace/*": ["packages/trace/src/*"], "@web/*": ["packages/web/src/*"], diff --git a/tsconfig.json b/tsconfig.json index c26c7fc9c6851..a027e586c8ff4 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -16,7 +16,6 @@ "@injected/*": ["./packages/injected/src/*"], "@isomorphic/*": ["./packages/isomorphic/*"], "@utils/*": ["./packages/utils/*"], - "@protocol/*": ["./packages/protocol/src/*"], "@recorder/*": ["./packages/recorder/src/*"], "@testIsomorphic/*": ["./packages/playwright/src/isomorphic/*"], "@trace/*": ["./packages/trace/src/*"], diff --git a/utils/eslint-plugin-progress/index.js b/utils/eslint-plugin-progress/index.js index 1a00e1a2a309a..394ade81b93be 100644 --- a/utils/eslint-plugin-progress/index.js +++ b/utils/eslint-plugin-progress/index.js @@ -121,7 +121,7 @@ const rule = createRule({ description: 'In methods accepting Progress, awaited async calls must pass progress or be wrapped in progress.race()', }, messages: { - missingProgress: 'Awaited async call must either pass `progress` as first argument or be wrapped in `progress.race()`. See packages/protocol/src/progress.d.ts.', + missingProgress: 'Awaited async call must either pass `progress` as first argument or be wrapped in `progress.race()`. See packages/playwright-core/src/server/progress.ts.', }, schema: [], }, diff --git a/utils/generate_channels.js b/utils/generate_channels.js index 33856d271fb3e..3c433aa43f82e 100755 --- a/utils/generate_channels.js +++ b/utils/generate_channels.js @@ -109,7 +109,8 @@ function objectType(props, indent, onlyOptional = false) { return { ts: `{\n${inner.ts}\n${indent}}`, scheme: `tObject({\n${inner.scheme}\n${indent}})` }; } -const channels_ts = [ +function channelsHeader(target) { + return [ `/** * Copyright (c) Microsoft Corporation. * @@ -126,16 +127,16 @@ const channels_ts = [ * limitations under the License. */ -// This file is generated by ${path.basename(__filename).split(path.sep).join(path.posix.sep)}, do not edit manually. +// This file is generated by ${path.basename(__filename).split(path.sep).join(path.posix.sep)}, do not edit manually.` + (target === 'Dispatcher' ? ` -import type { CallMetadata } from './callMetadata'; import type { Progress } from './progress'; - +` : '') + ` export type Binary = Buffer; export interface Channel { } `]; +} const validator_ts = [ `/** @@ -228,153 +229,164 @@ const entriesInReverse = interfaceEntries .sort((a, b) => depthOf(b.e[0]) - depthOf(a.e[0]) || a.i - b.i) .map(x => x.e); -channels_ts.push(`// ----------- Initializer Traits -----------`); -channels_ts.push(`export type InitializerTraits =`); -for (const [name, item] of entriesInReverse) { - if (item.type !== 'interface') - continue; - channels_ts.push(` T extends ${name}Channel ? ${name}Initializer :`); -} -channels_ts.push(` object;`); -channels_ts.push(``); -channels_ts.push(`// ----------- Event Traits -----------`); -channels_ts.push(`export type EventsTraits =`); -for (const [name, item] of entriesInReverse) { - if (item.type !== 'interface') - continue; - channels_ts.push(` T extends ${name}Channel ? ${name}Events :`); -} -channels_ts.push(` undefined;`); -channels_ts.push(``); -channels_ts.push(`// ----------- EventTarget Traits -----------`); -channels_ts.push(`export type EventTargetTraits =`); -for (const [name, item] of entriesInReverse) { - if (item.type !== 'interface') - continue; - channels_ts.push(` T extends ${name}Channel ? ${name}EventTarget :`); -} -channels_ts.push(` undefined;`); -channels_ts.push(``); +function generateChannels(target) { + const channels_ts = channelsHeader(target); + const isDispatcher = target === 'Dispatcher'; -for (const [name, item] of Object.entries(protocol)) { - if (item.type === 'interface') { - const channelName = name; - channels_ts.push(`// ----------- ${channelName} -----------`); - const init = objectType(item.initializer || {}, ''); - const initializerName = channelName + 'Initializer'; - channels_ts.push(`export type ${initializerName} = ${init.ts};`); - - let ancestorInit = init; - let ancestor = item; - while (!ancestor.initializer) { - if (!ancestor.extends) - break; - ancestor = channels.get(ancestor.extends); - ancestorInit = objectType(ancestor.initializer || {}, ''); - } - addScheme(`${channelName}Initializer`, ancestor.initializer ? ancestorInit.scheme : `tOptional(tObject({}))`); - - channels_ts.push(`export interface ${channelName}EventTarget {`); - const ts_types = new Map(); - - /** @type{{eventName: string, eventType: string}[]} */ - const eventTypes = []; - for (let [eventName, event] of Object.entries(item.events || {})) { - if (event === null) - event = {}; - const parameters = objectType(event.parameters || {}, ''); - const paramsName = `${channelName}${titleCase(eventName)}Event`; - ts_types.set(paramsName, parameters.ts); - channels_ts.push(` on(event: '${eventName}', callback: (params: ${paramsName}) => void): this;`); - eventTypes.push({eventName, eventType: paramsName}); - addScheme(paramsName, event.parameters ? parameters.scheme : `tOptional(tObject({}))`); - for (const derived of derivedClasses.get(channelName) || []) - addScheme(`${derived}${titleCase(eventName)}Event`, `tType('${paramsName}')`); - } - channels_ts.push(`}`); - - channels_ts.push(`export interface ${channelName}Channel extends ${channelName}EventTarget, ${(item.extends || '') + 'Channel'} {`); - channels_ts.push(` _type_${channelName}: boolean;`); - for (let [methodName, method] of Object.entries(item.commands || {})) { - if (method === null) - method = {}; - - - for (const className of [name, ...(derivedClasses.get(name) || [])]) { - if (method.flags?.slowMo && method.internal) - throw new Error(`Method "${className}.${methodName}" has "slowMo" flag, so cannot be "internal" in protocol.yml`); - if (method.flags?.snapshot && method.internal) - throw new Error(`Method "${className}.${methodName}" has "snapshot" flag, so cannot be "internal" in protocol.yml`); - if (method.flags?.pause && method.internal) - throw new Error(`Method "${className}.${methodName}" has "pause" flag, so cannot be "internal" in protocol.yml`); - if (!method.title && !method.internal) - throw new Error(`Method "${className}.${methodName}" must have a "title" because it is not "internal" in protocol.yml`); - if (method.group && method.internal) - throw new Error(`Method "${className}.${methodName}" must should not specify "group" because it is "internal" in protocol.yml`); - if (method.group && !['getter', 'configuration', 'route', 'default'].includes(method.group)) - throw new Error(`Unknown group "${method.group}" for method "${className}.${methodName}" in protocol.yml`); - const internalProp = method.internal ? ` internal: ${method.internal},` : ''; - const titleProp = method.title ? ` title: '${method.title}',` : ''; - const groupProp = method.group ? ` group: '${method.group}',` : ''; - const slowMoProp = method.flags?.slowMo ? ` slowMo: ${method.flags.slowMo},` : ''; - const snapshotProp = method.flags?.snapshot ? ` snapshot: ${method.flags.snapshot},` : ''; - const pauseProp = method.flags?.pause ? ` pause: ${method.flags.pause},` : ''; - const inputProp = method.flags?.input ? ` input: ${method.flags.input},` : ''; - const isAutoWaitingProp = method.flags?.isAutoWaiting ? ` isAutoWaiting: ${method.flags.isAutoWaiting},` : ''; - const potentiallyClosesScopeProp = method.flags?.potentiallyClosesScope ? ` potentiallyClosesScope: ${method.flags.potentiallyClosesScope},` : ''; - methodMetainfo.push(`['${className + '.' + methodName}', {${internalProp}${titleProp}${slowMoProp}${snapshotProp}${pauseProp}${inputProp}${isAutoWaitingProp}${potentiallyClosesScopeProp}${groupProp} }]`); + channels_ts.push(`// ----------- Initializer Traits -----------`); + channels_ts.push(`export type InitializerTraits =`); + for (const [name, item] of entriesInReverse) { + if (item.type !== 'interface') + continue; + channels_ts.push(` T extends ${name}Channel ? ${name}Initializer :`); + } + channels_ts.push(` object;`); + channels_ts.push(``); + channels_ts.push(`// ----------- Event Traits -----------`); + channels_ts.push(`export type EventsTraits =`); + for (const [name, item] of entriesInReverse) { + if (item.type !== 'interface') + continue; + channels_ts.push(` T extends ${name}Channel ? ${name}Events :`); + } + channels_ts.push(` undefined;`); + channels_ts.push(``); + channels_ts.push(`// ----------- EventTarget Traits -----------`); + channels_ts.push(`export type EventTargetTraits =`); + for (const [name, item] of entriesInReverse) { + if (item.type !== 'interface') + continue; + channels_ts.push(` T extends ${name}Channel ? ${name}EventTarget :`); + } + channels_ts.push(` undefined;`); + channels_ts.push(``); + + for (const [name, item] of Object.entries(protocol)) { + if (item.type === 'interface') { + const channelName = name; + channels_ts.push(`// ----------- ${channelName} -----------`); + const init = objectType(item.initializer || {}, ''); + const initializerName = channelName + 'Initializer'; + channels_ts.push(`export type ${initializerName} = ${init.ts};`); + + let ancestorInit = init; + let ancestor = item; + while (!ancestor.initializer) { + if (!ancestor.extends) + break; + ancestor = channels.get(ancestor.extends); + ancestorInit = objectType(ancestor.initializer || {}, ''); } + addScheme(`${channelName}Initializer`, ancestor.initializer ? ancestorInit.scheme : `tOptional(tObject({}))`); + + channels_ts.push(`export interface ${channelName}EventTarget {`); + const ts_types = new Map(); + + /** @type{{eventName: string, eventType: string}[]} */ + const eventTypes = []; + for (let [eventName, event] of Object.entries(item.events || {})) { + if (event === null) + event = {}; + const parameters = objectType(event.parameters || {}, ''); + const paramsName = `${channelName}${titleCase(eventName)}Event`; + ts_types.set(paramsName, parameters.ts); + if (isDispatcher) + channels_ts.push(` _dispatchEvent(event: '${eventName}', params?: ${paramsName}): void;`); + else + channels_ts.push(` on(event: '${eventName}', callback: (params: ${paramsName}) => void): this;`); + eventTypes.push({eventName, eventType: paramsName}); + addScheme(paramsName, event.parameters ? parameters.scheme : `tOptional(tObject({}))`); + for (const derived of derivedClasses.get(channelName) || []) + addScheme(`${derived}${titleCase(eventName)}Event`, `tType('${paramsName}')`); + } + channels_ts.push(`}`); + + channels_ts.push(`export interface ${channelName}Channel extends ${channelName}EventTarget, ${(item.extends || '') + 'Channel'} {`); + channels_ts.push(` _type_${channelName}: boolean;`); + for (let [methodName, method] of Object.entries(item.commands || {})) { + if (method === null) + method = {}; + + for (const className of [name, ...(derivedClasses.get(name) || [])]) { + if (method.flags?.slowMo && method.internal) + throw new Error(`Method "${className}.${methodName}" has "slowMo" flag, so cannot be "internal" in protocol.yml`); + if (method.flags?.snapshot && method.internal) + throw new Error(`Method "${className}.${methodName}" has "snapshot" flag, so cannot be "internal" in protocol.yml`); + if (method.flags?.pause && method.internal) + throw new Error(`Method "${className}.${methodName}" has "pause" flag, so cannot be "internal" in protocol.yml`); + if (!method.title && !method.internal) + throw new Error(`Method "${className}.${methodName}" must have a "title" because it is not "internal" in protocol.yml`); + if (method.group && method.internal) + throw new Error(`Method "${className}.${methodName}" must should not specify "group" because it is "internal" in protocol.yml`); + if (method.group && !['getter', 'configuration', 'route', 'default'].includes(method.group)) + throw new Error(`Unknown group "${method.group}" for method "${className}.${methodName}" in protocol.yml`); + const internalProp = method.internal ? ` internal: ${method.internal},` : ''; + const titleProp = method.title ? ` title: '${method.title}',` : ''; + const groupProp = method.group ? ` group: '${method.group}',` : ''; + const slowMoProp = method.flags?.slowMo ? ` slowMo: ${method.flags.slowMo},` : ''; + const snapshotProp = method.flags?.snapshot ? ` snapshot: ${method.flags.snapshot},` : ''; + const pauseProp = method.flags?.pause ? ` pause: ${method.flags.pause},` : ''; + const inputProp = method.flags?.input ? ` input: ${method.flags.input},` : ''; + const isAutoWaitingProp = method.flags?.isAutoWaiting ? ` isAutoWaiting: ${method.flags.isAutoWaiting},` : ''; + const potentiallyClosesScopeProp = method.flags?.potentiallyClosesScope ? ` potentiallyClosesScope: ${method.flags.potentiallyClosesScope},` : ''; + methodMetainfo.push(`['${className + '.' + methodName}', {${internalProp}${titleProp}${slowMoProp}${snapshotProp}${pauseProp}${inputProp}${isAutoWaitingProp}${potentiallyClosesScopeProp}${groupProp} }]`); + } + + const parameters = objectType(method.parameters || {}, ''); + const paramsName = `${channelName}${titleCase(methodName)}Params`; + const optionsName = `${channelName}${titleCase(methodName)}Options`; + ts_types.set(paramsName, parameters.ts); + ts_types.set(optionsName, objectType(method.parameters || {}, '', true).ts); + addScheme(paramsName, method.parameters ? parameters.scheme : `tOptional(tObject({}))`); + for (const derived of derivedClasses.get(channelName) || []) + addScheme(`${derived}${titleCase(methodName)}Params`, `tType('${paramsName}')`); - const parameters = objectType(method.parameters || {}, ''); - const paramsName = `${channelName}${titleCase(methodName)}Params`; - const optionsName = `${channelName}${titleCase(methodName)}Options`; - ts_types.set(paramsName, parameters.ts); - ts_types.set(optionsName, objectType(method.parameters || {}, '', true).ts); - addScheme(paramsName, method.parameters ? parameters.scheme : `tOptional(tObject({}))`); - for (const derived of derivedClasses.get(channelName) || []) - addScheme(`${derived}${titleCase(methodName)}Params`, `tType('${paramsName}')`); - - const resultName = `${channelName}${titleCase(methodName)}Result`; - const returns = objectType(method.returns || {}, ''); - ts_types.set(resultName, method.returns ? returns.ts : 'void'); - addScheme(resultName, method.returns ? returns.scheme : `tOptional(tObject({}))`); - for (const derived of derivedClasses.get(channelName) || []) - addScheme(`${derived}${titleCase(methodName)}Result`, `tType('${resultName}')`); - - if (method.errorDetails) { - const errorDetailsName = `${channelName}${titleCase(methodName)}ErrorDetails`; - const details = objectType(method.errorDetails, ''); - ts_types.set(errorDetailsName, details.ts); - addScheme(errorDetailsName, details.scheme); + const resultName = `${channelName}${titleCase(methodName)}Result`; + const returns = objectType(method.returns || {}, ''); + ts_types.set(resultName, method.returns ? returns.ts : 'void'); + addScheme(resultName, method.returns ? returns.scheme : `tOptional(tObject({}))`); for (const derived of derivedClasses.get(channelName) || []) - addScheme(`${derived}${titleCase(methodName)}ErrorDetails`, `tType('${errorDetailsName}')`); + addScheme(`${derived}${titleCase(methodName)}Result`, `tType('${resultName}')`); + + if (method.errorDetails) { + const errorDetailsName = `${channelName}${titleCase(methodName)}ErrorDetails`; + const details = objectType(method.errorDetails, ''); + ts_types.set(errorDetailsName, details.ts); + addScheme(errorDetailsName, details.scheme); + for (const derived of derivedClasses.get(channelName) || []) + addScheme(`${derived}${titleCase(methodName)}ErrorDetails`, `tType('${errorDetailsName}')`); + } + const secondParam = isDispatcher ? `, progress: Progress` : ''; + channels_ts.push(` ${methodName}(params${method.parameters || isDispatcher ? '' : '?'}: ${paramsName}${secondParam}): Promise<${resultName}>;`); } - channels_ts.push(` ${methodName}(params${method.parameters ? '' : '?'}: ${paramsName}, progress?: Progress): Promise<${resultName}>;`); + channels_ts.push(`}`); + for (const [typeName, typeValue] of ts_types) + channels_ts.push(`export type ${typeName} = ${typeValue};`); + channels_ts.push(``); + + channels_ts.push(`export interface ${channelName}Events {`); + for (const {eventName, eventType} of eventTypes) + channels_ts.push(` '${eventName}': ${eventType};`); + channels_ts.push(`}\n`); + + } else if (item.type === 'object') { + const inner = objectType(item.properties, ''); + channels_ts.push(`export type ${name} = ${inner.ts};`); + channels_ts.push(``); + addScheme(name, inner.scheme); + } else if (item.type === 'enum') { + const ts = item.literals.map(literal => `'${literal}'`).join(' | '); + channels_ts.push(`export type ${name} = ${ts};`) + addScheme(name, `tEnum([${item.literals.map(literal => `'${literal}'`).join(', ')}])`); } - - channels_ts.push(`}`); - for (const [typeName, typeValue] of ts_types) - channels_ts.push(`export type ${typeName} = ${typeValue};`); - channels_ts.push(``); - - channels_ts.push(`export interface ${channelName}Events {`); - for (const {eventName, eventType} of eventTypes) - channels_ts.push(` '${eventName}': ${eventType};`); - channels_ts.push(`}\n`); - - } else if (item.type === 'object') { - const inner = objectType(item.properties, ''); - channels_ts.push(`export type ${name} = ${inner.ts};`); - channels_ts.push(``); - addScheme(name, inner.scheme); - } else if (item.type === 'enum') { - const ts = item.literals.map(literal => `'${literal}'`).join(' | '); - channels_ts.push(`export type ${name} = ${ts};`) - addScheme(name, `tEnum([${item.literals.map(literal => `'${literal}'`).join(', ')}])`); } + + return channels_ts; } +const client_channels_ts = generateChannels('Channel'); + metainfo_ts.push(`export type MethodMetainfo = { internal?: boolean, title?: string, slowMo?: boolean, snapshot?: boolean, pause?: boolean, isAutoWaiting?: boolean, input?: boolean, potentiallyClosesScope?: boolean, group?: string }; export const methodMetainfo = new Map([ @@ -384,6 +396,10 @@ export const methodMetainfo = new Map([ export function getMetainfo(metadata: { type: string, method: string }): MethodMetainfo | undefined { return methodMetainfo.get(metadata.type + '.' + metadata.method); }`); +const metainfoContent = metainfo_ts.join('\n') + '\n'; +const validatorContent = validator_ts.join('\n') + '\n'; + +const server_channels_ts = generateChannels('Dispatcher'); let hasChanges = false; @@ -397,10 +413,12 @@ function writeFile(filePath, content) { hasChanges = true; const root = path.join(__dirname, '..'); console.log(`Writing //${path.relative(root, filePath)}`); + fs.mkdirSync(path.dirname(filePath), { recursive: true }); fs.writeFileSync(filePath, content, 'utf8'); } -writeFile(path.join(__dirname, '..', 'packages', 'protocol', 'src', 'channels.d.ts'), channels_ts.join('\n') + '\n'); -writeFile(path.join(__dirname, '..', 'packages', 'isomorphic', 'protocolMetainfo.ts'), metainfo_ts.join('\n') + '\n'); -writeFile(path.join(__dirname, '..', 'packages', 'playwright-core', 'src', 'protocol', 'validator.ts'), validator_ts.join('\n') + '\n'); +writeFile(path.join(__dirname, '..', 'packages', 'playwright-core', 'src', 'client', 'channels.d.ts'), client_channels_ts.join('\n') + '\n'); +writeFile(path.join(__dirname, '..', 'packages', 'playwright-core', 'src', 'server', 'channels.d.ts'), server_channels_ts.join('\n') + '\n'); +writeFile(path.join(__dirname, '..', 'packages', 'isomorphic', 'protocolMetainfo.ts'), metainfoContent); +writeFile(path.join(__dirname, '..', 'packages', 'playwright-core', 'src', 'protocol', 'validator.ts'), validatorContent); process.exit(hasChanges ? 1 : 0);